Network communication optimization method based on reconfigurable chip and related device

Through the network communication optimization method based on reconfigurable chips, using the Baotou domain feature data for strategy comparison, the complex problem of private data head processing between switches by different manufacturers is solved, and flexible and efficient private head removal processing is achieved.

CN119561994APending Publication Date: 2025-03-04CHINA ELECTRIC POWER RESEARCH INSTITUTE CO LTD +2

Patent Information

Application Number
CN202411744021.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-30
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

In an internal switching network, network cards need to identify and remove private data headers in non-normal data packets. However, the switch hardware settings of different manufacturers are different, resulting in complex and costly processing.

Method used

The network communication optimization method based on the reconfigurable chip is adopted, and by obtaining the packet header domain feature data, policy comparison is performed, private header processing rules are obtained, and private header removal is performed.

Benefits of technology

It realizes flexible adaptation to abnormal data packets generated by different manufacturers and switches, reduces development and maintenance costs, and adapts to the diversity of network environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119561994A_ABST
    Figure CN119561994A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of information security, and discloses a network communication optimization method based on a reconfigurable chip and a related device, and the method comprises the steps: obtaining a to-be-processed message, and extracting the packet header domain feature data of the to-be-processed message; comparing in a plurality of preset strategies according to the packet header domain feature data to obtain a strategy matching result; obtaining a private header processing rule of the to-be-processed message according to a strategy matching result, and performing private header removal processing on the to-be-processed message according to the private header processing rule of the to-be-processed message; wherein the strategy comprises comparison data and the offset of the private data head of the message header. According to the method, private header removal processing can be accurately carried out, abnormal data packets with private data headers generated by switches of different manufacturers and different models can be flexibly adapted, the strategy can be expanded and modified according to actual requirements, and diversity of network environments can be coped with.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of information security, and relates to a network communication optimization method based on a reconfigurable chip and a related device. Background Art

[0002] In an internal switching network, the network card often receives a variety of messages, including data packets with normal headers, but also abnormal data packets with private data headers before the MAC address (hardware address). This situation is very common in a switching network composed of stacked switches. For such abnormal data packets, after receiving the message, the network card must first identify them before normal processing, and then remove the private data header that is not of concern by setting the private data header offset of the message header. Then, the subsequent modules can perform normal network card processing on the message.

[0003] In the actual network, there is another problem that the number of bytes of the private data header set by the hardware of different models of switches produced by different manufacturers may also be different. Therefore, a more complex processing flow is required to identify and distinguish them. In addition, the software and hardware environment of the network is very complex, and the above-mentioned removal of private data headers often requires consideration of multiple situations.

[0004] At present, the simplest processing method is to set a register value in the network card through a command, so as to achieve offset processing for all received messages, and the offset is the above register value. The characteristic of this method is that it is relatively simple, but it is only applicable to particularly simple and single network environments. Another method is to develop and upgrade the pre-processing firmware in the network card according to the specific network environment, so as to achieve the removal of private data headers. The disadvantage of this solution is that the development cost is high, and the modification and maintenance cost is high. It is generally only applicable to relatively stable and less changing network environments. Summary of the invention

[0005] The purpose of the present invention is to overcome the above-mentioned shortcomings of the prior art and provide a network communication optimization method based on a reconfigurable chip and related devices.

[0006] In order to achieve the above object, the present invention adopts the following technical solutions:

[0007] In a first aspect, the present invention provides a network communication optimization method based on a reconfigurable chip, comprising: obtaining a message to be processed and extracting packet header domain feature data of the message to be processed; performing comparison among several preset strategies based on the packet header domain feature data to obtain a strategy matching result; obtaining a private header processing rule of the message to be processed based on the strategy matching result, and performing private header removal processing on the message to be processed based on the private header processing rule of the message to be processed; wherein the strategy includes comparison data and a private data header offset of the message header.

[0008] Optionally, the packet header domain characteristic data includes one or more of the following: input port, source MAC address, destination MAC address, Ethernet type, VLAN tag, VLAN priority, source IP, destination IP, IP protocol, IP service type, TCP / UDP source port number and TCP / UDP destination port number.

[0009] Optionally, the comparing among several preset strategies based on the packet header domain characteristic data includes: compressing the packet header domain characteristic data by a preset characteristic compression method to obtain compressed packet header domain characteristic data; and comparing among several preset strategies based on the compressed packet header domain characteristic data.

[0010] Optionally, the method of comparing the packet header domain characteristic data among several preset policies to obtain a policy matching result includes: obtaining the address to be compared through a preset address hash function based on the packet header domain characteristic data; and obtaining the policy to be compared from several policies based on the address to be compared and a preset policy hash table; comparing the packet header domain characteristic data with the comparison data in the policy to be compared, and when the packet header domain characteristic data is consistent with the comparison data in the policy to be compared, the policy matching result is that a matching policy exists; when the packet header domain characteristic data is inconsistent with the comparison data in the policy to be compared, the policy matching result is that no matching policy exists.

[0011] Optionally, the preset several policies are stored in a content-addressable memory; the comparison is performed among the preset several policies according to the packet header domain characteristic data to obtain a policy matching result, including: based on the packet header domain characteristic data, comparing the packet header domain characteristic data with the comparison data in each policy through the content-addressable memory; when there is a policy with the same comparison data as the packet header domain characteristic data, the policy matching result is that there is a matching policy; when there is no policy with the same comparison data as the packet header domain characteristic data, the policy matching result is that there is no matching policy.

[0012] Optionally, the preset several strategies are stored in a ternary content addressable memory; the comparison data in the strategies include non-fuzzy comparison data and fuzzy comparison data; the comparison is performed in the preset several strategies according to the packet header domain feature data to obtain the strategy matching result, including: dividing the packet header domain feature data into non-fuzzy matching data and fuzzy matching data; comparing the non-fuzzy matching data with the non-fuzzy comparison data in the comparison data in each strategy through the ternary content addressable memory, and comparing the fuzzy matching data with the fuzzy comparison data in the comparison data in each strategy; when there is a strategy in which the non-fuzzy comparison data is the same as the non-fuzzy matching data and the fuzzy matching data is fuzzily matched successfully, the strategy matching result is that there is a matching strategy; when there is no strategy in which the non-fuzzy comparison data is the same as the non-fuzzy matching data and the fuzzy matching data is fuzzily matched successfully, the strategy matching result is that there is no matching strategy.

[0013] Optionally, the private header processing rules for the message to be processed obtained according to the policy matching result include: when the policy matching result is that there is a matching policy, the private header processing rules for the message to be processed are: obtain the matching policy, and use the message header private data header offset in the matching policy as the message header private data header offset during private header removal processing; when the policy matching result is that there is no matching policy, the private header processing rules for the message to be processed are: use a preset default value as the message header private data header offset during private header removal processing.

[0014] Optionally, it also includes: performing policy configuration of a plurality of preset policies according to the policy configuration command.

[0015] According to a second aspect of the present invention, a network communication optimization system based on a reconfigurable chip is provided, comprising: a data acquisition module, used to acquire a message to be processed and extract packet header domain feature data of the message to be processed; a policy matching module, used to compare among several preset policies according to the packet header domain feature data to obtain a policy matching result; a message processing module, used to obtain a private header processing rule of the message to be processed according to the policy matching result, and perform private header removal processing on the message to be processed according to the private header processing rule of the message to be processed; wherein the policy includes comparison data and a private data header offset of the message header.

[0016] Optionally, the private header processing rules for the message to be processed obtained according to the policy matching result include: when the policy matching result is that there is a matching policy, the private header processing rules for the message to be processed are: obtain the matching policy, and use the message header private data header offset in the matching policy as the message header private data header offset during private header removal processing; when the policy matching result is that there is no matching policy, the private header processing rules for the message to be processed are: use a preset default value as the message header private data header offset during private header removal processing.

[0017] According to a third aspect of the present invention, a computer device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above-mentioned network communication optimization method based on a reconfigurable chip when executing the computer program.

[0018] According to a fourth aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned network communication optimization method based on a reconfigurable chip are implemented.

[0019] Compared with the prior art, the present invention has the following beneficial effects:

[0020] The present invention is based on a network communication optimization method of a reconfigurable chip. First, the header field feature data of the message to be processed is extracted, and then a comparison is performed in a plurality of preset strategies according to the header field feature data to obtain a strategy matching result and a private header processing rule of the message to be processed is obtained based on the strategy matching result, thereby realizing the private header removal processing of the message to be processed. The reconfigurable chip contains a plurality of independent computing cores, namely, reconfigurable cores, each of which has a programmable function. By programming the reconfigurable cores of the reconfigurable chip, when the strategy is determined, some of the reconfigurable cores can complete the matching function of the header field data, and other reconfigurable cores can complete the private header removal. By comparing the header field feature data with the preset strategy, the private header removal processing can be accurately performed, and the abnormal data packets with private data headers generated by switches of different manufacturers and different models can be flexibly adapted. The strategy can be expanded and modified according to actual needs. When the network environment changes or new processing rules need to be added, only the policy library needs to be updated, and there is no need to modify or upgrade the system on a large scale, and it can cope with the diversity of network environments. In actual applications, users only need to configure corresponding strategies to achieve the required functions without in-depth understanding of the underlying implementation details, which can well meet the actual needs in network communications. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 This is a flow chart of a network communication optimization method based on a reconfigurable chip according to an embodiment of the present invention.

[0022] Figure 2 This is a flow chart of adding strategy steps according to an embodiment of the present invention.

[0023] Figure 3 The present invention is a flowchart of the message matching strategy steps according to an embodiment of the present invention.

[0024] Figure 4 The figure is a flow chart of the message processing steps of an embodiment of the present invention.

[0025] Figure 5 This is a flow chart of adding strategy steps based on a Hash table according to an embodiment of the present invention.

[0026] Figure 6 The present invention is a flowchart of a message matching strategy based on a hash table according to an embodiment of the present invention.

[0027] Figure 7 The figure is a flow chart of the steps of a CAM-based message matching strategy according to an embodiment of the present invention.

[0028] Figure 8 The present invention is a flowchart of a TCAM-based message matching strategy step.

[0029] Fig. 9 The configuration command calling hierarchy diagram of the embodiment of the present invention.

[0030] Fig.10 The figure is a structural block diagram of a network communication optimization system based on a reconfigurable chip according to an embodiment of the present invention. DETAILED DESCRIPTION

[0031] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only 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 should fall within the scope of protection of the present invention.

[0032] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0033] The present invention is further described in detail below in conjunction with the accompanying drawings:

[0034] See also Figure 1 In one embodiment of the present invention, a network communication optimization method based on a reconfigurable chip is provided, specifically a network communication optimization method based on a reconfigurable chip based on reconfigurable technology, which defines a set of flexible, powerful and adaptable message private header processing solutions, which can realize the accurate removal of private headers of different types of messages.

[0035] Specifically, the network communication optimization method based on the reconfigurable chip of the present invention comprises the following steps:

[0036] S1: Obtain the message to be processed and extract the packet header field feature data of the message to be processed.

[0037] S2: Compare the packet header domain feature data with several preset strategies to obtain a strategy matching result.

[0038] S3: Obtain a private header processing rule of the message to be processed according to the policy matching result, and perform private header removal processing on the message to be processed according to the private header processing rule of the message to be processed.

[0039] The strategy includes comparing data and private data header offsets of message headers.

[0040] The present invention is based on a network communication optimization method of a reconfigurable chip. First, the header field feature data of the message to be processed is extracted, and then a comparison is performed in a plurality of preset strategies according to the header field feature data to obtain a strategy matching result and a private header processing rule of the message to be processed is obtained based on the strategy matching result, thereby realizing the private header removal processing of the message to be processed. The reconfigurable chip contains a plurality of independent computing cores, namely, reconfigurable cores, each of which has a programmable function. By programming the reconfigurable cores of the reconfigurable chip, when the strategy is determined, some of the reconfigurable cores can complete the matching function of the header field data, and other reconfigurable cores can complete the private header removal. By comparing the header field feature data with the preset strategy, the private header removal processing can be accurately performed, and the abnormal data packets with private data headers generated by switches of different manufacturers and different models can be flexibly adapted. The strategy can be expanded and modified according to actual needs. When the network environment changes or new processing rules need to be added, only the policy library needs to be updated, and there is no need to modify or upgrade the system on a large scale, and it can cope with the diversity of network environments. In actual applications, users only need to configure corresponding strategies to achieve the required functions without in-depth understanding of the underlying implementation details, which can well meet the actual needs in network communications.

[0041] Specifically, reconfigurable chips have the characteristics of dual programming of software and hardware, and the hardware architecture and functions change dynamically in real time with the changes of software, so they are also called software-defined chips. The emergence of reconfigurable chips has opened up the channel of "application-defined software, software-defined chips" and then realized "application-defined chips", and its wide adaptability has also made it a strong competitor to replace dedicated integrated circuits, programmable devices and classic processors.

[0042] Reconfigurable chips are often misunderstood as field programmable gate arrays (FPGAs). To illustrate the uniqueness of reconfigurable chips, a four-quadrant coordinate diagram is constructed with software programmability and hardware programmability as the two axes, and then we can see which quadrant the existing chips can be placed in. Interestingly, well-known processors, such as central processing units (CPUs) and digital signal processors (DSPs), are in the second quadrant because their software is programmable and the hardware is basically not very movable. System on chip (SOC) and application-specific integrated circuits (ASICs) are in the third quadrant, while FPGAs and erasable programmable logic devices (EPLDs) are in the fourth quadrant.

[0043] The chips in the first quadrant are not only software programmable, but also hardware programmable, and even the hardware is programmable under the programming of software. The first quadrant can be summarized as dynamically reconfigurable chips, sometimes called reconfigurable computing processors (RCP) or coarse-grained reconfigurable architectures (CGRA), etc. Its characteristics are: both software and hardware can be programmed, mixed granularity, the hardware functions of the chip change with the changes of software, the application changes the software, and the software changes the hardware. Moreover, it has many similarities with processors such as CPUs, and developers do not need low-level chip design instructions. This type of chip has good energy efficiency and computing efficiency, just like ASIC. Obviously, the attribute classification of this chip is different from before, and it cannot be confused with FPGAs, etc.

[0044] In one possible implementation, the packet header domain characteristic data includes one or more of the following: input port, source MAC address, destination MAC address, Ethernet type, VLAN tag, VLAN priority, source IP, destination IP, IP protocol, IP service type, TCP / UDP source port number and TCP / UDP destination port number.

[0045] Specifically, the packet header field of the message can be composed of a twelve-tuple, which covers most of the identifiers of the link layer, network layer and transport layer, and basically covers layers 1 to 4 of the OSI model (full name Open Systems Interconnection Model, which is a network interconnection model proposed by the International Organization for Standardization (ISO)). Input port: It is the first layer, indicating which port the message enters the switch from. Source MAC address, destination MAC address, Ethernet type, VLAN tag and VLAN priority: located in the second layer. Source IP, destination IP, IP protocol and IP service type: located in the third layer. TCP / UDP source port number and TCP / UDP destination port number: located in the fourth layer. It is also possible to select only some fields of the above twelve-tuple or process them as packet header field feature data according to actual conditions.

[0046] Among them, the source MAC address (Media Access Control Address) is also called the hardware address or physical address, which is used to uniquely identify a network card in the network. The source MAC address refers to the MAC address of the sender contained in the header of the data packet when sending a data packet. The destination MAC address refers to the MAC address of the receiver contained in the header of the data packet. The network device forwards the data packet to the correct receiver based on this address. The Ethernet type field is located in the header of the Ethernet frame and is used to indicate the type of data in the data field. It helps the receiving device to identify and correctly process the received data packet. VLAN (Virtual Local Area Network) is a virtual local area network. The VLAN tag is used to identify the VLAN to which the data packet belongs in the Ethernet frame. The VLAN tag usually contains information such as the VLAN ID, which is used to achieve the division and isolation of virtual networks. The VLAN priority is used to assign different priorities to data packets when transmitting within or across VLANs. This helps to give priority to the transmission of important or urgent data packets when the network is congested. The value range of the VLAN priority may vary depending on different standards and implementations. The source IP address refers to the IP address of the sender contained in the header of the data packet. IP address is Internet Protocol Address, which is used to uniquely identify a device or network interface in an IP network. The destination IP address refers to the IP address of the receiver contained in the header of the data packet. It is the destination identifier of the data packet transmitted in the network. IP protocol is the abbreviation of Internet Protocol, which is one of the core protocols in the TCP / IP protocol suite. The IP protocol is responsible for transmitting data packets from the source address to the destination address to realize the data transmission function of the network layer. IP Type of Service (TOS) or Differentiated Services Code Point (DSCP) is a field in the IP header that indicates the service type and priority of the data packet. It allows the network to process different types of data packets differently to meet different network requirements and Quality of Service (QoS) requirements. TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are two commonly used transport layer protocols. The source port number refers to the sender's port number contained in the data packet header, which is used to identify the sender's application or service. The destination port number refers to the receiver's port number contained in the data packet header, which is used to identify the receiver's application or service. The receiving device forwards the data packet to the corresponding application or service according to the destination port number.

[0047] Based on the above description, when designing a strategy, the comparison data is the data corresponding to the characteristic data in the packet header field, and the private data header offset of the message header is used to indicate how many bytes the message header should be offset by to remove the private data header after receiving a message to be processed with matching characteristic data in the packet header field.

[0048] In a possible implementation, the comparing among several preset strategies based on the header domain feature data includes: compressing the header domain feature data by a preset feature compression method to obtain compressed header domain feature data; and comparing among several preset strategies based on the compressed header domain feature data.

[0049] For details, see Figure 2 , you need to add policy steps first, including:

[0050] 1. Delivery strategy: Application layer interface,<Tuple,Offset> The data is passed to the hardware circuit through the driver interface; Tuple is the comparison data, and part of the twelve-tuple can be selected as this part of the data as needed, and Offset is the offset of the private data header of the message header. The essential content of the strategy data contains the configuration information of the reconfigurable network chip firmware, so that the internal units in the reconfigurable network chip can realize the reconfiguration of different algorithms to meet the implementation of network optimization strategies.

[0051] 2. Policy feature extraction: 12-Tuple refers to a twelve-tuple, which is the most complete matching solution for policies and messages. However, in actual use, it may be necessary to use all or part of the fields for compression as policy features.

[0052] 3. Feature compression: Since the amount of data directly stored during storage will be very large, the comparison data can be compressed into comparison data before storage. The most common feature compression method is to define a fixed feature compression hash function.

[0053] 4. Storage location determination: It depends on the underlying data structure and related algorithms. In practice, it can be implemented based on hash tables, CAM (Content Addressable Memory) and TCAM (Ternary Content Addressable Memory). The storage location of the same strategy is different under different implementation methods.

[0054] 5. Storage strategy: After determining the content to be stored <comparison data, Offset> and the storage location, store the content in the corresponding location.

[0055] See also Figure 3 , and then proceed to the message matching strategy steps, including:

[0056] 1. Receive message: After receiving a message, before performing all normal message processing, analyze and delete the private header of the message.

[0057] 2. Extraction of packet header domain feature data: that is, according to the defined policy rules when storing the policy, extract the packet header domain feature data of the message, such as the packet header domain feature data of the five-tuple or twelve-tuple features.

[0058] 3. Feature compression: Corresponding to the rules of the storage strategy, the extracted header domain feature data is compressed and then compared with the comparison data. It should be noted that the compression operation of the header domain feature data must use the same compression operation as when storing the strategy in order to achieve accurate comparison.

[0059] 4. Locate the strategy storage location: This step corresponds to step 4 when adding a strategy. It also depends on the underlying data structure and uses a traversal method to achieve strategy location.

[0060] 5. Feature matching: The extracted and compressed packet header feature data is matched with the pre-stored and defined comparison data until the corresponding policy is found, and the offset of the successfully matched policy is returned. Or if the possible equal policies are not found after the comparison, and the match is confirmed to have failed, a special tag value of the agreed match failure is returned, such as 0xFFFF_FFFFF.

[0061] See also Figure 4 After the matching is completed, the message processing steps include:

[0062] 1. For the successfully matched message, that is, the return value is not a special mark value, it is processed according to the pre-configured message header private data header offset, so as to achieve the effect of removing the message private header.

[0063] 2. For messages that fail to match, that is, the return value is 0xFFFF_FFFF, they are processed according to the default rules, which can be no processing or processing according to the default message header private data header offset.

[0064] In a possible implementation, the comparison is performed among several preset policies based on the packet header domain characteristic data to obtain a policy matching result, including: obtaining the address to be compared through a preset address hash function based on the packet header domain characteristic data; and obtaining the policy to be compared from several policies based on the address to be compared and a preset policy hash table; comparing the packet header domain characteristic data with the comparison data in the policy to be compared, and when the packet header domain characteristic data is consistent with the comparison data in the policy to be compared, the policy matching result is that a matching policy exists; when the packet header domain characteristic data is inconsistent with the comparison data in the policy to be compared, the policy matching result is that a matching policy does not exist.

[0065] Specifically, in this implementation, the matching of the strategy and the message to be processed is implemented based on the Hash table.

[0066] There are a lot of research and extensive results on the data structure of the Hash table and the related operations and algorithms on its data structure. Here, the working principle of the present invention is explained only from the simplified Hash table structure. A simple implementation scheme of the hash table requires the definition of two Hash functions. 1. HASH_Key: compression hash function, this hash function mainly solves the problem of excessive data volume. Compression through compression hash function can facilitate storage and comparison. 2. HASH_Addr: address hash function, this hash function is used for address mapping of the hash table, mapping data to the corresponding address of the corresponding hash table. Among them, the compression hash function is to solve the problem of excessive data volume. If the problem of excessive data volume is not considered, the compression hash function can also be not set, and the comparison data and the packet header field feature data can be directly compared.

[0067] In this embodiment, see Figure 5 In the strategy adding stage, the related operations are merged and adapted by combining the data structure characteristics of the Hash table. The operations in the strategy adding stage can be listed as follows:

[0068] 1. Use the address hash function to hash the policy comparison data and confirm the location where the policy needs to be stored (and confirm that the address is not occupied and there is no conflict).

[0069] 2. Use compressed hash functions to perform feature compression on the strategy comparison data.

[0070] 3. Store the comparison data compression result and Offset value into the data storage location obtained in step 1.

[0071] See also Figure 6 In the message matching strategy stage, the operations are listed as follows:

[0072] 1. Extract the packet header field feature data from the message.

[0073] 2. Use the address hash function to hash the characteristic data in the packet header field, confirm the storage location of the policy that needs to be compared with this message, and retrieve the comparison data compression result.

[0074] 3. Use the compression hash function to compress the characteristic data in the packet header field.

[0075] 4. Compare the compressed hash value of the packet header feature data with the compressed result of the matching policy. If the comparison is successful, the Offset value of the policy can be retrieved and returned. If the comparison fails, the special tag value 0xFFFF_FFFF is returned.

[0076] In a possible implementation, the preset several policies are stored in a content-addressable memory; the comparison among the preset several policies based on the packet header domain feature data to obtain the policy matching result includes: based on the packet header domain feature data, comparing the packet header domain feature data with the comparison data in each policy through the content-addressable memory; when there is a policy with the same comparison data as the packet header domain feature data, the policy matching result is that there is a matching policy; when there is no policy with the same comparison data as the packet header domain feature data, the policy matching result is that there is no matching policy.

[0077] Specifically, in this embodiment, the matching of strategies and messages to be processed is implemented based on CAM. CAM is an associative memory storage device implemented on the basis of traditional storage technology. Unlike software search, the advantage of CAM search is that it can match all entries in the table in parallel, and only one hardware clock cycle is required to complete the precise matching of keywords, which improves the speed of table lookup. The traditional storage device RAM obtains the data stored in the corresponding position through the address value. However, if the stored data is given, a matching search needs to be performed, which requires multiple cycles to complete. The speed of implementing the search is not ideal. Therefore, CAM came into being. In principle, it does the opposite, and the data is used as a key to search for its address. According to the nature of the CAM design, the search is parallel, which means that the search can be completed in one cycle. This makes CAM more suitable for data table search, and it is faster.

[0078] There are three basic operations of CAM: write operation: input address and data, write data to the specified address, the writing speed is the same as RAM; read operation: input address, return data at the address, the reading speed is the same as RAM; search operation: input data to be searched, return the address where the data is stored. This is also the main purpose of CAM, it can quickly search from a huge database and return the best matching address, the fastest search speed can reach more than 100 million times per second.

[0079] In this implementation, in the strategy adding stage, the compressed hash function of the previous solution can also be used, which can ensure that a small amount of CAM storage space is used and facilitate rapid data comparison. The strategy adding stage is implemented through the CAM write operation, because the CAM supports random address reading and writing, and automatically maintains the number of valid data and storage space. By combining the data structure characteristics of the CAM device, the related operations are merged and adapted, and the operations of the strategy adding stage can be listed as follows:

[0080] 1. Confirm the policy storage address: Since CAM is a linear table with sequential storage, the next free storage location to store the policy can be obtained based on the number of policies currently stored in CAM.

[0081] 2. Use compressed hash functions to perform feature compression on the strategy comparison data.

[0082] 3. Storage strategy: By using the CAM write operation, the comparison data compression result and the Offset value are stored in the data storage location obtained in step 1.

[0083] See also Figure 7 In the message matching strategy stage, the operations are listed as follows:

[0084] 1. Extract the packet header field feature data from the message.

[0085] 2. Use the compressed hash function to compress the characteristic data in the packet header field.

[0086] 3. Compare the compressed packet header feature data with the policy comparison data compression result stored in the CAM device. Since the CAM performs parallel comparison, this operation can be completed in one cycle. If the comparison is successful, the Offset value can be retrieved and returned. If the comparison fails, a special flag value 0xFFFF_FFFF is returned.

[0087] It should be noted that almost all network cards are internally integrated with a CAM device, and the CAM can be easily reused to implement the matching of the strategy of the present invention and the message to be processed.

[0088] In a possible implementation, the preset several strategies are stored in a ternary content addressable memory; the comparison data in the strategies include non-fuzzy comparison data and fuzzy comparison data; the comparison is performed in the preset several strategies according to the header domain feature data to obtain the strategy matching result, including: dividing the header domain feature data into non-fuzzy matching data and fuzzy matching data; comparing the non-fuzzy matching data with the non-fuzzy comparison data in the comparison data in each strategy through the ternary content addressable memory, and comparing the fuzzy matching data with the fuzzy comparison data in the comparison data in each strategy; when there is a strategy in which the non-fuzzy comparison data is the same as the non-fuzzy matching data and the fuzzy matching data is fuzzily matched successfully, the strategy matching result is that there is a matching strategy; when there is no strategy in which the non-fuzzy comparison data is the same as the non-fuzzy matching data and the fuzzy matching data is fuzzily matched successfully, the strategy matching result is that there is no matching strategy.

[0089] Specifically, in this implementation, the matching of policies and messages to be processed is implemented based on TCAM.

[0090] The CAM in the above scheme refers to the CAM in the general sense, or BCAM. However, two different types of CAM are commonly used, namely BCAM (Binary CAM) and TCAM (Ternary CAM). BCAM, as the name implies, refers to data in binary state, that is, 0 or 1, and data search must be completely matched. It is suitable for data queries with unique entries, such as MAC address queries. TCAM is the abbreviation of Ternary Content Addressable Memory, which means "three-state content addressable memory". It is developed on the basis of CAM. In general CAM memory, each bit has only two states, "0" or "1", while each bit in TCAM has three states. In addition to "0" and "1", there is also a "don't care" state, which can also be called "wildcard" or "X", which means ignore in Chinese. So it is called "three-state", which is realized through masking. It is this third state feature of TCAM that enables it to perform both exact match search and fuzzy match search. TCAM's fuzzy matching is particularly suitable for matching IP address segments. For example, when writing 1.1.1.0 / 24, it describes the range of IP addresses from 1.1.1.0 to 1.1.1.255. The number 24 means that the first 24 bits of the IP address must be matched, and it does not matter what the last 8 bits are.

[0091] Therefore, according to the characteristics of the elements, the source IP address (IP_src) and the destination IP address (IP_dst) in the twelve-tuple are listed separately and do not participate in the operation of the compressed hash function. The modified policy storage data structure is:<Hash_Key,IP_src,IP_dst> , Offset>; where IP_src and IP_dst are both IP address segments that can support fuzzy matching, i.e., fuzzy matching data. Hash_Key is the other tuple fields in the policy feature tuple except the IP address, i.e., non-fuzzy matching data, which can be processed by compressed hash function.

[0092] The write and read operations of TCAM are the same as those of ordinary random access RAM memory. The search operation is the most important use of TCAM. Compared with random access memory, which uses data address as index, TCAM uses data content as index and quickly returns the found storage address value through parallel comparison.

[0093] In this implementation, in the strategy adding stage, it is implemented through the write operation of TCAM. TCAM supports random address reading and writing, and automatically maintains the number of valid data and storage space. By combining and adapting the relevant operations in combination with the data structure characteristics of the TCAM device, the operations in the strategy adding stage can be listed as follows:

[0094] 1. Confirm the policy storage address: Since TCAM is a linear table with sequential storage, the next free storage location for storing the policy can be obtained based on the number of policies currently stored in TCAM.

[0095] 2. Feature compression: Use the compressed hash function to perform feature compression on the non-fuzzy touch comparison data in the comparison data to obtain the compression result of the non-fuzzy touch comparison data.

[0096] 3. Storage strategy: By using the write operation of TCAM, <<non-fuzzy comparison data compression result, fuzzy comparison data>, Offset> is stored in the data storage location obtained in step 1.

[0097] See also Figure 8 In the message matching strategy stage, the operations are listed as follows:

[0098] 1. Extract the packet header field feature data from the message.

[0099] 2. Use the compression hash function to compress the non-fuzzy matching data in the packet header domain feature data to obtain <<non-fuzzy matching data compression result, fuzzy matching data>, Offset>.

[0100] 3. Compare the non-fuzzy matching data compression result with the non-fuzzy comparison data compression result of the strategy stored in the TCAM device, and compare the fuzzy matching data with the fuzzy comparison data (supporting fuzzy matching). Since TCAM is a parallel comparison, this operation can be completed in one cycle. If the comparison is successful, the Offset value can be retrieved and returned. If the comparison fails, a special tag value 0xFFFF_FFFF is returned.

[0101] From the above discussion, the matching of policies and messages to be processed based on TCAM can well support the matching of IP address segments, make policy configuration more convenient, increase configuration flexibility, and make management functions more powerful.

[0102] In a possible implementation, the private header processing rule of the message to be processed obtained according to the policy matching result includes: when the policy matching result is that there is a matching policy, the private header processing rule of the message to be processed is: obtaining the matching policy, and using the message header private data header offset in the matching policy as the message header private data header offset during private header removal processing; when the policy matching result is that there is no matching policy, the private header processing rule of the message to be processed is: using a preset default value as the message header private data header offset during private header removal processing.

[0103] Specifically, the private data header offset of the message header in the matching policy is used as the private data header offset of the message header during private header removal processing, which generally means that when performing private header removal processing, the message to be processed is offset leftward by the private data header offset of the message header.

[0104] The preset default value may be 0, that is, no offset is performed on the message to be processed.

[0105] In a possible implementation manner, the network communication optimization method based on a reconfigurable chip further includes: performing policy configuration of a plurality of preset policies according to a policy configuration command.

[0106] Specifically, the policy configuration command implements the configuration of the policy, such as adding, deleting, and modifying.

[0107] Specifically, in this implementation, the following commands are defined.

[0108] Command 1: PrivateHeaderOffset Add: indicates that a new policy is to be added. The specific parameters can be Begin and End, which respectively represent the beginning of the policy setting and the completion of the policy setting.

[0109] Command 2: PrivateHeaderOffset Set: indicates setting the specific content of a policy. Specific parameters correspond to specific values. You do not need to use all twelve tuples, but only take some of the fields. When matching the message, the remaining unset fields are not extracted, that is, the match is successful by default.

[0110] Command 3: PrivateHeaderOffset Load: means loading and configuring related policies from a text file, and the parameter is the corresponding file name.

[0111] Command 4: PrivateHeaderOffset Store: means saving all configured policies to the text file filename. The parameter is the corresponding file name.

[0112] Command 5: PrivateHeaderOffset Clear: means deleting all configured policies.

[0113] The configuration command, as a standard external program under Linux, depends on the glibc library under the Linux platform. Glibc is the libc library released by GNU, that is, the C function library. Glibc is the lowest-level API in the Linux system, and almost any other runtime library will depend on glibc. In addition, in this implementation, see Fig. 9 Taking the most common PCIe interface network card as an example, the calling hierarchy of the entire configuration command is as follows:

[0114] Shell external command (application) → GNU C function library → Linux system call interface (including network card driver interface) → Kernel (kernel) → PCIe interface → network card configuration data. Among them, you can also skip the GNU C function library and go from Shell external command → Linux system call interface.

[0115] The following are device embodiments of the present invention, which can be used to implement the method embodiments of the present invention. For details not disclosed in the device embodiments, please refer to the method embodiments of the present invention.

[0116] See also Fig.10 In another embodiment of the present invention, a network communication optimization system based on a reconfigurable chip is provided, which can be used to implement the above-mentioned network communication optimization method based on a reconfigurable chip. Specifically, the network communication optimization system based on a reconfigurable chip includes a data acquisition module, a strategy matching module and a message processing module.

[0117] Among them, the data acquisition module is used to obtain the message to be processed and extract the header field feature data of the message to be processed; the policy matching module is used to compare the header field feature data in a plurality of preset policies to obtain the policy matching result; the message processing module is used to obtain the private header processing rule of the message to be processed according to the policy matching result, and perform private header removal processing on the message to be processed according to the private header processing rule of the message to be processed; wherein the policy includes comparison data and the private data header offset of the message header.

[0118] In a possible implementation, the private header processing rule of the message to be processed obtained according to the policy matching result includes: when the policy matching result is that there is a matching policy, the private header processing rule of the message to be processed is: obtaining the matching policy, and using the message header private data header offset in the matching policy as the message header private data header offset during private header removal processing; when the policy matching result is that there is no matching policy, the private header processing rule of the message to be processed is: using a preset default value as the message header private data header offset during private header removal processing.

[0119] All relevant contents of each step involved in the embodiment of the aforementioned network communication optimization method based on a reconfigurable chip can be referred to the functional description of the functional modules corresponding to the network communication optimization system based on a reconfigurable chip in the embodiment of the present invention, and will not be repeated here.

[0120] The division of modules in the embodiments of the present invention is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional module in each embodiment of the present invention may be integrated into one processor, or may exist physically separately, or two or more modules may be integrated into one module. The above-mentioned integrated modules may be implemented in the form of hardware or in the form of software functional modules.

[0121] In another embodiment of the present invention, a computer device is provided, the computer device including a processor and a memory, the memory is used to store a computer program, the computer program includes program instructions, and the processor is used to execute the program instructions stored in the computer storage medium. The processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc., which are the computing core and control core of the terminal, which are suitable for implementing one or more instructions, and are specifically suitable for loading and executing one or more instructions in the computer storage medium to implement the corresponding method flow or corresponding function; the processor described in the embodiment of the present invention can be used for the operation of the network communication optimization method based on a reconfigurable chip.

[0122] In another embodiment of the present invention, the present invention also provides a storage medium, specifically a computer-readable storage medium (Memory), which is a memory device in a computer device for storing programs and data. It can be understood that the computer-readable storage medium here can include both built-in storage media in the computer device and, of course, extended storage media supported by the computer device. The computer-readable storage medium provides a storage space, which stores the operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. The processor can load and execute one or more instructions stored in the computer-readable storage medium to implement the corresponding steps of the network communication optimization method based on a reconfigurable chip in the above embodiment.

[0123] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0124] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0125] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0126] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0127] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents. Any modification or equivalent replacement that does not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. A network communication optimization method based on a reconfigurable chip, characterized in that: include: Obtaining the message to be processed and extracting the packet header field feature data of the message to be processed; Compare the packet header domain feature data with several preset strategies to obtain a strategy matching result; Obtain the private header processing rule of the message to be processed according to the policy matching result, and perform private header removal processing on the message to be processed according to the private header processing rule of the message to be processed; The strategy includes comparing data and private data header offsets of message headers.

2. The network communication optimization method based on reconfigurable chip according to claim 1 is characterized in that: The packet header domain characteristic data includes one or more of the following: input port, source MAC address, destination MAC address, Ethernet type, VLAN tag, VLAN priority, source IP, destination IP, IP protocol, IP service type, TCP / UDP source port number and TCP / UDP destination port number.

3. The network communication optimization method based on reconfigurable chip according to claim 1 is characterized in that: The comparison among several preset strategies according to the packet header domain feature data includes: Compressing the packet header domain characteristic data by a preset characteristic compression method to obtain compressed packet header domain characteristic data; Compare the compressed packet header field feature data among several preset strategies.

4. The network communication optimization method based on reconfigurable chip according to claim 1 is characterized in that: The strategy matching result obtained by comparing the packet header domain feature data with a plurality of preset strategies includes: Based on the packet header domain feature data, the address to be compared is obtained through a preset address hash function; and the strategy to be compared is obtained from a number of strategies according to the address to be compared and a preset strategy hash table; The packet header domain feature data is compared with the comparison data in the policy to be compared. When the packet header domain feature data is consistent with the comparison data in the policy to be compared, the policy matching result is that there is a matching policy; when the packet header domain feature data is inconsistent with the comparison data in the policy to be compared, the policy matching result is that there is no matching policy.

5. The network communication optimization method based on reconfigurable chip according to claim 1 is characterized in that: The preset strategies are stored in a content addressable memory; The strategy matching result obtained by comparing the packet header domain feature data with a plurality of preset strategies includes: Based on the packet header domain feature data, the packet header domain feature data is compared with the comparison data in each policy through a content addressable memory; When there is a policy whose comparison data is identical to the packet header domain feature data, the policy matching result is that there is a matching policy; when there is no policy whose comparison data is identical to the packet header domain feature data, the policy matching result is that there is no matching policy.

6. The network communication optimization method based on reconfigurable chip according to claim 1 is characterized in that: The preset several strategies are stored in a ternary content addressable memory; the comparison data in the strategy includes non-fuzzy comparison data and fuzzy comparison data; the strategy matching results obtained by comparing the preset several strategies according to the packet header domain feature data include: Divide the packet header domain feature data into non-fuzzy matching data and fuzzy matching data; The non-fuzzy matching data is compared with the non-fuzzy matching data in the matching data in each strategy, and the fuzzy matching data is compared with the fuzzy matching data in the matching data in each strategy through a ternary content addressable memory; when there is a strategy in which the non-fuzzy matching data is identical to the non-fuzzy matching data and the fuzzy matching data successfully fuzzily matches the fuzzy matching data, the strategy matching result is that there is a matching strategy; when there is no strategy in which the non-fuzzy matching data is identical to the non-fuzzy matching data and the fuzzy matching data successfully fuzzily matches the fuzzy comparison data, the strategy matching result is that there is no matching strategy.

7. The network communication optimization method based on reconfigurable chip according to claim 1 is characterized in that: The private header processing rules of the message to be processed obtained according to the policy matching result include: When the policy matching result is that there is a matching policy, the private header processing rule of the message to be processed is: obtain the matching policy, and use the private data header offset of the message header in the matching policy as the private data header offset of the message header during the private header removal processing; When the policy matching result is that there is no matching policy, the private header processing rule of the message to be processed is: a preset default value is used as the private data header offset of the message header when the private header is removed.

8. The network communication optimization method based on reconfigurable chip according to claim 1 is characterized in that: Also includes: According to the policy configuration command, the policy configuration of several preset policies is performed.

9. A network communication optimization system based on a reconfigurable chip, characterized in that: include: The data acquisition module is used to acquire the message to be processed and extract the packet header field feature data of the message to be processed; A strategy matching module is used to compare the packet header domain feature data with a number of preset strategies to obtain a strategy matching result; The message processing module is used to obtain the private header processing rule of the message to be processed according to the policy matching result, and remove the private header of the message to be processed according to the private header processing rule of the message to be processed; The strategy includes comparing data and private data header offsets of message headers.

10. The network communication optimization system based on reconfigurable chip according to claim 9, characterized in that: The private header processing rules of the message to be processed obtained according to the policy matching result include: When the policy matching result is that there is a matching policy, the private header processing rule of the message to be processed is: obtain the matching policy, and use the private data header offset of the message header in the matching policy as the private data header offset of the message header during the private header removal processing; When the policy matching result is that there is no matching policy, the private header processing rule of the message to be processed is: a preset default value is used as the private data header offset of the message header when the private header is removed.

11. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the network communication optimization method based on a reconfigurable chip are implemented as described in any one of claims 1 to 8.

12. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the network communication optimization method based on a reconfigurable chip as claimed in any one of claims 1 to 8 are implemented.

Citation Information

Patent Citations

  • Tunnel message analysis method and device

    CN105939304A

  • Large-scale network data processing method based on reconfigurable switch chip architecture

    CN108833299A

  • Fuzzy test case generation method suitable for industrial control private protocol

    CN110597734A

  • Network message processing strategy generation method and system, and medium

    CN111277612A

  • DNS strategy configuration method and system and storage medium

    CN111711712A

Cited By

  • Reconfigurable intelligent network card and reconfiguration method

    CN122698383A