Method and device for parallel message analysis of Ethernet chip based on multi-stage TCAM

The multi-level TCAM parallel parsing method solves the problem of low efficiency in packet header information parsing in Ethernet chips, achieves efficient parallel parsing, saves TCAM resources and reduces chip costs.

CN120812151APending Publication Date: 2025-10-17KUNGAO XINXIN MICROELECTRONICS (JIANGSU) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510887961.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-30
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

In existing Ethernet chips, packet header information is parsed in a serial manner, which is inefficient and time-consuming. For packets with long nested header information, such as tunnels and VPNs, the parsing efficiency is even lower and TCAM resources are seriously wasted.

Method used

A multi-level TCAM parallel parsing method is adopted, and each level of TCAM is flexibly configured to match the specified position and length of the packet header information. The packet header information is segmented according to the field offset position of each level of TCAM, and different parsing methods are executed in parallel.

Benefits of technology

This significantly improves the speed and efficiency of parsing message header information, saves TCAM resources, and reduces chip costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120812151A_ABST
    Figure CN120812151A_ABST
Patent Text Reader

Abstract

The invention discloses a method and a device for an Ethernet chip to parse messages in parallel based on a multi-stage TCAM (Ternary Content Addressable Memory). The method comprises the following steps: S1, enabling an enable message parallel parsing function; s2, configuring a multi-level TCAM matching rule, configuring a multi-level TCAM according to the length of the message header information needing to be analyzed, configuring a corresponding numerical value at a specific field offset position for each entry of each level of TCAM so as to match with the whole or part of the corresponding message header format, and storing the message header information needing to be analyzed in the message header information needing to be analyzed in the message header information needing to be analyzed in the message header information needing to be analyzed in the message header information needing to be analyzed in the message header information needing to be analyzed. The specific field offset position is used for segmenting information of a message header, and each entry is associated with a corresponding analysis rule; s3, after the message is received, judging whether the header of the message hits the multi-level TCAM rule or not, if so, executing the step S4, and if not, analyzing according to a conventional serial analysis mode; and S4, based on the entry of each level of hit TCAM, segmenting the message header information and obtaining the associated corresponding analysis rule so as to execute parallel analysis on the message header information.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of Ethernet message analysis, and particularly relates to a method and device for parallel message analysis of an Ethernet chip based on multi-level TCAM. BACKGROUND

[0002] The conventional message analysis mode of the current industry switch is to analyze the message header field by field in sequence, and to determine the analysis mode of the subsequent message header according to the Ethernet data type or protocol type analyzed in the front. The whole presents a serial mode operation, and no matter what kind of message header is analyzed byte by byte from front to back until the whole analysis is completed. For data transmission such as Tunnel and VPN, the general message header information will have a nested multi-layer ipv4 header or ipv6 header, the overall message header information is long, the serial analysis mode is time-consuming, and the efficiency is low. SUMMARY

[0003] In view of the above technical problems, the present application innovatively performs parallel matching in advance through multi-level TCAM, and flexibly configures the enablement of each level of TCAM according to the length of the message header information to be analyzed. The specified position and length of each level of TCAM matching the message header information are supported. The message header information is segmented by the field offset position of the message header information in each level of TCAM, and each segment can perform different analysis modes, so that the message header information is changed from the traditional serial analysis mode to the parallel analysis mode, the message header information analysis speed and efficiency are significantly improved, the TCAM resources are saved, and the chip cost is reduced.

[0004] In order to achieve the above purpose, the technical scheme of the present application provides a method for parallel message analysis of an Ethernet chip based on multi-level TCAM, which comprises the following steps: S1: enabling the message parallel analysis function; S2: configuring multi-level TCAM matching rules, configuring multi-level TCAM according to the length of the message header information to be analyzed, the sum of the entry lengths of each level of TCAM is greater than or equal to the maximum length of the message header information to be analyzed, and the corresponding value is configured at the specific field offset position of each entry of each level of TCAM to match the whole or part of the corresponding message header format, wherein the specific field offset position of each entry of each level of TCAM is used to segment the message header information, and each entry of each level of TCAM is associated with a corresponding analysis rule; S3: after receiving the message, judging whether the received message header hits the multi-level TCAM rule configured in step S2, if yes, proceeding to step S4, otherwise analyzing the message header information according to the conventional serial analysis mode; S4: based on the entry of each level of TCAM hit, segmenting the message header information and obtaining the associated corresponding analysis rule to perform parallel analysis on the message header information.

[0005] Furthermore, in step S2, based on the packet header format standard to be matched, a specific field offset position is selected for each entry of each level of TCAM and a corresponding value is configured.

[0006] Furthermore, in step S2, the entries of each level of TCAM are associated with the action table entries, and corresponding parsing rules are configured in the action table entries. Each set of parsing rules is used to specify the parsing method and starting position of each segment of the message, so that the message header information is segmented and processed in parallel by indexing to the corresponding action table entry.

[0007] Furthermore, in step S2, the parsing rules configured in the action table entry support parsing the following message header format structures: ETH2, ARP, ICMP, IGMP, IPv4, IPv6, TCP, UDP, MPLS, and VXLAN.

[0008] Furthermore, in step S2, the action table item supports user-defined parsing mode.

[0009] The technical solution of the present invention also provides an Ethernet chip based on multi-level TCAM parallel parsing message device, which includes the following modules: an enabling module: used to enable the enable message parallel parsing function; a multi-level TCAM rule configuration module: used to configure the multi-level TCAM A matching rule is configured, wherein a multi-level TCAM is configured according to the length of the message header information to be parsed, the sum of the entry lengths of each level of TCAM being greater than or equal to the maximum length of the message header information supported for parsing, and a corresponding value is configured at a specific field offset position for each entry in each level of TCAM to match the entirety or part of the corresponding message header format, wherein the specific field offset position of each entry in each level of TCAM is used to segment the message header information, and each entry in each level of TCAM is associated with a corresponding parsing rule; a message matching module is configured to, after receiving a message, determine whether the received message header matches the multi-level TCAM rule configured by the multi-level TCAM rule configuration module; a parsing module is configured to perform serial parsing on the message header information when the message header does not match the multi-level TCAM rule configured by the multi-level TCAM rule configuration module; and when the message header matches the multi-level TCAM rule configured by the multi-level TCAM rule configuration module, segment the message header information based on the hit entry of each level of TCAM and obtain the associated corresponding parsing rule to perform parallel parsing on the message header information.

[0010] Further, in the multi-level TCAM rule configuration module, based on the format standard of the packet header to be matched, a specific field offset position is selected for each entry of each level of TCAM and a corresponding value is configured.

[0011] Further, in the multi-level TCAM rule configuration module, the entries of each level of TCAM are associated with action table items, and corresponding analysis rules are configured in the action table items, each set of analysis rules being used to specify the analysis manner and starting position of each segment of the packet, so that the packet header information is segmented and processed in parallel by being indexed to the corresponding action table items.

[0012] Further, in the multi-level TCAM rule configuration module, the analysis rules configured in the action table items support analysis of the following packet header format structures: ETH2, ARP, ICMP, IGMP, IPv4, IPv6, TCP, UDP, MPLS, and VXLAN.

[0013] Further, in the multi-level TCAM rule configuration module, the action table items support user-defined analysis manners. BRIEF DESCRIPTION OF DRAWINGS

[0014] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the embodiments. It should be understood that the following drawings only show some of the embodiments of the present application, and therefore should not be considered as a limitation on the scope, and for those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.

[0015] Figure 1 is an example diagram of the packet analysis principle of the present application. DETAILED DESCRIPTION

[0016] The technical solutions in the embodiments of the present application will be described clearly and completely in the following with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.

[0017] The application can be flexibly configured according to the length of the message header information to be parsed by innovatively using multi-stage TCAM. The basic requirement is that the sum of the lengths of the entries of the TCAM must be greater than or equal to the maximum length of the whole header information of the complex message to be parsed. The number of TCAM stages needs to be reasonably designed in combination with actual needs, cost and manufacturing process. For a large bandwidth Ethernet chip, four stages are generally designed, the delay of parallel matching between stages is lower, and a balance between cost and demand can be achieved.

[0018] Before parsing, the specified position data of the whole message header information to be matched is configured in each stage of the TCAM, which is specified by the user, such as the offset position of the Ethernet type field or the offset position of the protocol type field. After parallel matching and searching in each stage, the message header information is parsed in parallel according to the matching results of each stage in the specified manner. The specific parsing can be configured by the user or parsed according to a certain fixed message format.

[0019] The advantage of multi-stage TCAM over one-stage TCAM matching is that it can save TCAM resources. On the one hand, one-stage TCAM matching needs to cover many types of complex messages, resulting in a large byte length for one entry. When the message header information to be parsed is not very long, a lot of space in one entry is wasted. Using multi-stage TCAM, only the first stage needs to be configured. On the other hand, when many complex messages need to be parsed, one-stage TCAM matching needs to configure one entry for each type of message. Multi-stage TCAM matching can share the same TCAM resources for complex messages that have the same parts.

[0020] The application enables each stage of TCAM by using multi-stage TCAM to perform parallel matching first and flexibly configuring each stage of TCAM according to the length of the message header information to be parsed. The specified position and length of the message header information matched by each stage of TCAM are supported. The message header information is segmented by the field offset position matched in each stage of TCAM, and each segment can perform different parsing methods, so that the message header information is changed from the traditional serial parsing method to the parallel parsing method, which significantly improves the message header information parsing speed and efficiency, saves TCAM resources, and reduces chip cost.

[0021] Reference Figure 1, the specific number of multi-stage TCAM is determined according to the actual application scene of the chip. The function of enabling complex packet parallel analysis is enabled, and each stage of TCAM participating in matching is enabled. If it is not enabled, the data is parsed in the conventional serial mode. After enabling parallel fast analysis and related multi-stage TCAM, the data rules of TCAM matching and the corresponding hit post-processing behavior need to be configured. The parallel search of each stage of TCAM will hit each stage of TCAM entry as an index to the action table item to make the analysis behavior. The specific analysis mode is configured in the action table item, which includes but is not limited to the analysis of various packet format structures such as ETH2 / ARP / ICMP / IGMP / IPv4 / IPv6 / TCP / UDP / MPLS / VXLAN, etc. according to the needs, and the starting position of the related packet format analysis is specified. At the same time, the user can customize the analysis mode to parse the specified field into a certain packet header or special information for other functional modules configured by the user.

[0022] After TACM, the entire packet header information can obtain the packet part analysis format and starting position from the action table item according to the rules in the matching. Each analysis mode analyzes part of the entire packet header information, and the chip can execute these analysis modes in parallel to realize the fast analysis of the packet header information, which is much more efficient than the traditional serial analysis scheme. Embodiments

[0023] Taking the analysis of IPv6 in IPv4 and IP in IP tunnel packets as an example, the length information of the packet can be known after the packet enters the chip through MAC. According to the traditional and conventional serial analysis mode, the packet header information is first parsed field by field, and when the EthType field is parsed, according to the value 0x0800, it is known that the subsequent is parsed according to the IPv4 header format. When the packet is parsed according to the IPv4 header format, when the protocol field is parsed, if it is found that the value is 0x4, it is an IP in IP packet, that is, it is known that after the IPv4 header is parsed, the following is the IPv4 packet format header, and the parsing is continued. If the value is 0x29, it is an IPv6 in IPv4 packet, that is, it is known that after the IPv4 header is parsed, the following is the IPv6 header, and the parsing of the entire packet header information is completed. The entire process cannot be skipped, and the subsequent analysis mode is determined by the previous analysis content.

[0024] Using the technical solution of the present application, firstly, the parallel analysis function is enabled, and the first two levels in the multi-level TCMA matching function are enabled. Since the first half of the two tunnel packet header information is the same, the first level TCAM only needs to configure an entry, and the fields that need to be matched in the same part of the two packet headers are configured with corresponding values at the corresponding positions of the TCAM, that is, 0x800 is configured at the EthType field offset position, and 0x29 is configured at the protocol field offset position in the IPv4 packet header. Two entries are configured in the second level TCAM, which are set to 4 and 6 at the ip packet format version field offset position respectively, for matching ipv4 and ipv6 packet headers, and the second level TCAM is configured to match the header information of the entire packet starting from the offset position of 38 bytes (if there is a vlan tag, the length thereof needs to be added). The Action1 table item corresponds to the behavior of the first level TCAM hit, wherein header0 is configured as eth2, offset0 is configured as 0, header1 is configured as ipv4, and offset1 is configured as 14 (if the packet contains a vlan tag, offset=18). The Action2 table item corresponds to the behavior of the second level TCAM hit, wherein entry1 in action2 is configured with header0 configured as ipv6 and offset0 configured as 0, and entry2 in action2 is configured with header0 configured as ipv4 and offset0 configured as 0. When the chip receives the two tunnel packets that hit the configured TCAM, the chip can obtain the packet parts from the Action table item, and analyze the packets in parallel according to the analysis information of different packet formats. Compared with the conventional serial analysis mode, the efficiency is significantly improved.

[0025] The key of the present application is to use multi-level TCAM to match in advance and save TCAM resources. Before analyzing the packet, the packet is segmented according to the hit rule and the analysis mode of each segment is determined. When the packet is being analyzed, the analysis is performed in parallel according to the determined analysis mode, so that the packet header information can be quickly analyzed, the internal delay and pipeline period of the chip are reduced, and the internal efficiency of the chip is improved.

[0026] It can be understood that, in addition to the above disclosed mode, the present application can also use a hash table to perform hash calculation on the fields of the relevant specified packet header information to determine the relevant analysis mode. However, this scheme needs to perform hash calculation before analysis, which consumes calculation resources and time, and the overall efficiency is lower than that of the TCAM implementation mode, and the design logic is complex. In addition, a single level TCAM can be designed, but multiple matching searches are performed to indirectly realize the function of multi-level matching. However, compared with multi-level parallel matching, multiple TCAM matching takes longer time and has lower efficiency.

[0027] In an embodiment of the present invention, a method for parallel parsing of messages based on a multi-stage TCAM on an Ethernet chip is provided, comprising the following steps: S1: enabling a parallel message parsing function; S2: configuring a multi-stage TCAM matching rule, configuring a multi-stage TCAM based on the length of message header information to be parsed, wherein the sum of the entry lengths of each stage of the TCAM is greater than or equal to the maximum length of message header information supported for parsing; configuring a corresponding value at a specific field offset position of each entry in each stage of the TCAM to match the entirety or part of the corresponding message header format, wherein the specific field offset position of each entry in each stage of the TCAM is used to segment message header information, and each entry in each stage of the TCAM is associated with a corresponding parsing rule; S3: upon receiving a message, determining whether the received message header matches the multi-stage TCAM rule configured in step S2; if so, proceeding to step S4; otherwise, parsing the message header information in a conventional serial parsing manner; S4: segmenting the message header information based on the matching entries in each stage of the TCAM and obtaining the associated corresponding parsing rules to perform parallel parsing on the message header information.

[0028] Furthermore, in step S2, based on the packet header format standard to be matched, a specific field offset position is selected for each entry of each level of TCAM and a corresponding value is configured.

[0029] Furthermore, in step S2, the entries of each level of TCAM are associated with the action table entries, and corresponding parsing rules are configured in the action table entries. Each set of parsing rules is used to specify the parsing method and starting position of each segment of the message, so that the message header information is segmented and processed in parallel by indexing to the corresponding action table entry.

[0030] Furthermore, in step S2, the parsing rules configured in the action table entry support parsing the following message header format structures: ETH2, ARP, ICMP, IGMP, IPv4, IPv6, TCP, UDP, MPLS, and VXLAN.

[0031] Furthermore, in step S2, the action table item supports user-defined parsing mode.

[0032] In another embodiment of the present application, there is also provided an apparatus for Ethernet chip to resolve packet based on multi-stage TCAM in parallel, comprising the following modules: an enabling module for enabling packet parallel resolution function; a multi-stage TCAM rule configuration module for configuring multi-stage TCAM matching rules, configuring multi-stage TCAM according to the length of the packet header information to be resolved, the sum of the length of each entry of each stage of TCAM being greater than or equal to the maximum length of the packet header information to be resolved, and configuring corresponding values at specific field offset positions of each entry of each stage of TCAM for matching the whole or part of the corresponding packet header format, wherein the specific field offset positions of each entry of each stage of TCAM are used for segmenting the information of the packet header, and each entry of each stage of TCAM is associated with a corresponding resolution rule; a packet matching module for judging whether the received packet header hits the multi-stage TCAM rules configured by the multi-stage TCAM rule configuration module after receiving the packet; and a resolution module for performing serial resolution on the packet header information when the packet header does not hit the multi-stage TCAM rules configured by the multi-stage TCAM rule configuration module, and performing parallel resolution on the packet header information based on the hit entries of each stage of TCAM and the associated corresponding resolution rules when the packet header hits the multi-stage TCAM rules configured by the multi-stage TCAM rule configuration module.

[0033] Further, in the multi-stage TCAM rule configuration module, the specific field offset positions of each entry of each stage of TCAM are selected and corresponding values are configured based on the packet header format standard to be matched.

[0034] Further, in the multi-stage TCAM rule configuration module, the entries of each stage of TCAM are associated with action table items, and corresponding resolution rules are configured in the action table items, each set of resolution rules being used for specifying the resolution method and starting position of each segment of the packet, so that the packet header information is segmented and processed in parallel by indexing to the corresponding action table items.

[0035] Further, in the multi-stage TCAM rule configuration module, the resolution rules configured in the action table items support resolving the following packet header format structures: ETH2, ARP, ICMP, IGMP, IPv4, IPv6, TCP, UDP, MPLS, and VXLAN.

[0036] Further, in the multi-stage TCAM rule configuration module, the action table items support user-defined resolution methods.

[0037] Compared with the conventional serial analysis mode and single-stage TCAM matching, the application can save TCAM resources while realizing parallel message header information analysis. The analysis speed is fast, especially when applied to an ultra-large bandwidth Ethernet switching chip, internal delay and pipeline period can be significantly saved. Moreover, the overall logic is simple, the design is convenient, the function is stable and reliable, and the research and development cost is low.

[0038] The above is only the preferred specific embodiment of the present application, but the protection scope of the present application is not limited to this. Any person skilled in the art can make equivalent replacement or change according to the technical scheme and the inventive concept of the present application within the technical range disclosed by the present application, which should be covered within the protection scope of the present application.

Claims

1. A method for parsing messages in parallel on an Ethernet chip based on multi-level TCAM, characterized in that: The steps include: S1: Enable the parallel parsing function of the enable message; S2: Configure multi-level TCAM matching rules. Based on the length of the packet header information to be parsed, configure multi-level TCAMs. The sum of the entry lengths of each level of TCAM is greater than or equal to the maximum length of the packet header information that can be parsed. For each entry in each level of TCAM, configure a corresponding value at a specific field offset position to match the entire or partial format of the corresponding packet header. The specific field offset position of each entry in each level of TCAM is used to segment the packet header information. Each entry in each level of TCAM is associated with a corresponding parsing rule. S3: After receiving the message, determine whether the received message header matches the multi-level TCAM rule configured in step S2. If so, proceed to step S4; otherwise, parse the message header information according to the conventional serial parsing method; S4: Based on the hit entries of each level of TCAM, the message header information is segmented and the associated corresponding parsing rules are obtained to perform parallel parsing on the message header information.

2. The method according to claim 1, characterized in that In step S2, based on the packet header format standard to be matched, a specific field offset position is selected for each entry of each level of TCAM and a corresponding value is configured.

3. The method according to claim 2, characterized in that In step S2, the entries of each level of TCAM are associated with the action table entries, and the corresponding parsing rules are configured in the action table entries. Each set of parsing rules is used to specify the parsing method and starting position of each segment of the message, so that the message header information is segmented and processed in parallel by indexing to the corresponding action table entry.

4. The method according to claim 3, characterized in that In step S2, the parsing rules configured in the action table entry support parsing the following packet header format structures: ETH2, ARP, ICMP, IGMP, IPv4, IPv6, TCP, UDP, MPLS, and VXLAN.

5. The method according to claim 3, characterized in that In step S2, the action table item supports user-defined parsing methods.

6. A device for Ethernet chip to parse messages in parallel based on multi-level TCAM, characterized in that: Includes the following modules: Enable module: used to enable the parallel parsing function of enable messages; Multi-level TCAM rule configuration module: used to configure multi-level TCAM matching rules. Based on the length of the packet header information to be parsed, the multi-level TCAM is configured. The sum of the entry lengths of each level of TCAM is greater than or equal to the maximum length of the packet header information that can be parsed. For each entry in each level of TCAM, a corresponding value is configured at a specific field offset position to match the entire or partial format of the corresponding packet header. The specific field offset position of each entry in each level of TCAM is used to segment the packet header information. Each entry in each level of TCAM is associated with a corresponding parsing rule. Message matching module: after receiving a message, it is used to determine whether the received message header matches the multi-level TCAM rule configured by the multi-level TCAM rule configuration module; Parsing module: used to perform serial parsing on the message header information when the message header does not hit the multi-level TCAM rule configured by the multi-level TCAM rule configuration module; and when the message header hits the multi-level TCAM rule configured by the multi-level TCAM rule configuration module, segment the message header information based on the entry of each level of TCAM that hits and obtain the associated corresponding parsing rules to perform parallel parsing on the message header information.

7. The device according to claim 6, characterized in that In the multi-level TCAM rule configuration module, based on the packet header format standard to be matched, a specific field offset position is selected for each entry in each level of TCAM and the corresponding value is configured.

8. The device according to claim 7, characterized in that In the multi-level TCAM rule configuration module, the entries at each level of TCAM are associated with action table items. The corresponding parsing rules are configured in the action table items. Each set of parsing rules is used to specify the parsing method and starting position of each segment of the message. The corresponding action table item is then indexed by index to perform parallel processing of the message header information in segments.

9. The device according to claim 8, characterized in that In the multi-level TCAM rule configuration module, the parsing rules configured in the action table support parsing the following packet header formats: ETH2, ARP, ICMP, IGMP, IPv4, IPv6, TCP, UDP, MPLS, and VXLAN.

10. The device according to claim 8, characterized in that In the multi-level TCAM rule configuration module, action entries support user-defined parsing methods.

Citation Information

Patent Citations

  • General analysis system and method for network protocol message of ship information system

    CN116708607A

  • Method for realizing DPI based on single TCAM, DPI engine and Ethernet switching chip

    CN119052121A

  • Data packet analyzer and method based on FPGA (Field Programmable Gate Array)

    CN119728808A