[go: up one dir, main page]

HK1220832B - A method of handling large protocol layers for configurable extraction of layer information and an apparatus thereof - Google Patents

A method of handling large protocol layers for configurable extraction of layer information and an apparatus thereof

Info

Publication number
HK1220832B
HK1220832B HK16108890.6A HK16108890A HK1220832B HK 1220832 B HK1220832 B HK 1220832B HK 16108890 A HK16108890 A HK 16108890A HK 1220832 B HK1220832 B HK 1220832B
Authority
HK
Hong Kong
Prior art keywords
layers
protocol layers
array
data packet
layer
Prior art date
Application number
HK16108890.6A
Other languages
Chinese (zh)
Other versions
HK1220832A1 (en
Inventor
V‧阿南德
T‧丹尼尔
P‧泰文德兰
Original Assignee
马维尔亚洲私人有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from US14/309,763 external-priority patent/US10616380B2/en
Application filed by 马维尔亚洲私人有限公司 filed Critical 马维尔亚洲私人有限公司
Publication of HK1220832A1 publication Critical patent/HK1220832A1/en
Publication of HK1220832B publication Critical patent/HK1220832B/en

Links

Description

针对层信息的可配置提取处理大协议层的方法以及设备Method and device for processing large protocol layers with configurable extraction of layer information

技术领域Technical Field

本发明涉及一种网络数据包。更具体地,本发明涉及一种针对层信息的可配置提取处理大协议层的方法以及设备。The present invention relates to a network data packet, and more particularly to a method and device for processing a large protocol layer with respect to configurable extraction of layer information.

背景技术Background Art

网络数据包包括多个业务层或协议层,其中每一个层都与其他层独立。虽然传统的硬件实施提供解析能力,但是传统的硬件实施不够灵活并且资源低效。这种不灵活性和低效性的一个限制是各个层的最大长度。这种限制由必须被构建在硬件中的字段选择电路所支配。进入硬件的逻辑与最大层长度成正比。例如,为了从层中以可编程的方式提取“T”总字节,其中该层可以具有“L”字节的大小,该层所需要的字节MUX的总数为T*(L:1)个MUX。由此,“L”越大,字段选择电路的大小就越大,这就增加了硬件成本。如果解析器引擎能够处理数据包中的多个层,那么总MUX结构成本就是字段选择电路的大小乘以解析器引擎所支持的层的数目。Network packets include multiple service layers or protocol layers, each of which is independent of the other layers. While traditional hardware implementations provide parsing capabilities, traditional hardware implementations are not flexible enough and are resource inefficient. One limitation of this inflexibility and inefficiency is the maximum length of each layer. This limitation is dominated by the field selection circuitry that must be built into the hardware. The logic that goes into the hardware is proportional to the maximum layer length. For example, in order to extract "T" total bytes from a layer in a programmable manner, where the layer can have a size of "L" bytes, the total number of byte MUXs required for the layer is T*(L:1) MUXs. Therefore, the larger "L", the larger the size of the field selection circuitry, which increases the hardware cost. If the parser engine is capable of processing multiple layers in a packet, then the total MUX structure cost is the size of the field selection circuitry multiplied by the number of layers supported by the parser engine.

发明内容Summary of the Invention

用于处理大协议层的装置的实施例涉及优化字段选择电路的实施。这种实施在解析数据包时为硬件解析器引擎提供类似软件的灵活性。该实施限制每一层的大小并且将任何超出该大小的层分离为较小的层。解析器引擎如同从非分离层提取数据一样从分离的层提取数据并且接着将所提取的数据级联为最终的结果。An embodiment of an apparatus for processing large protocol layers involves the implementation of optimized field selection circuitry. This implementation provides a hardware parser engine with software-like flexibility when parsing packets. The implementation limits the size of each layer and separates any layers exceeding that size into smaller layers. The parser engine extracts data from the separated layers just as it would from a non-separated layer and then concatenates the extracted data into a final result.

在一个方面,提供一种实施解析器引擎的方法。该方法包括:基于协议层将数据包的层进行分离,使得数据包的协议层的每一个都分隔开。在一些实施例中,将数据包的层分离包括将数据包的每个协议层的层类型存储在第一阵列中并且将数据包的每一个协议层所结束的位置的偏移存储在第二阵列中。In one aspect, a method of implementing a parser engine is provided. The method includes separating layers of a data packet based on protocol layers, such that each of the protocol layers of the data packet is separated. In some embodiments, separating the layers of the data packet includes storing a layer type of each protocol layer of the data packet in a first array and storing an offset of a location where each protocol layer of the data packet ends in a second array.

所述方法包括进一步将数据包的协议层中具有大于预定大小的大小的协议层的每一个分离为多个层。基于进一步的分离对第一阵列和第二阵列进行更新。在一些实施例中,预定大小为软件限定的。The method further includes separating each of the protocol layers of the data packet having a size greater than a predetermined size into a plurality of layers. The first array and the second array are updated based on the further separation. In some embodiments, the predetermined size is software defined.

所述方法包括处理所有的分离层。在一些实施例中,处理所有的分离层包括将分离层的每一层归纳为通用格式并且从所归纳的分离层的每一层选择内容。在一些实施例中,从所归纳的分离层的每一层选择内容包括将来自通用命令集合中的至少一个应用到所归纳的分离层从而从所归纳的分离层提取字段。在一些实施例中,通用命令集合中的每一个都与协议层中的特定字段无关。The method includes processing all of the separation layers. In some embodiments, processing all of the separation layers includes reducing each layer of the separation layers to a common format and selecting content from each of the reduced separation layers. In some embodiments, selecting content from each of the reduced separation layers includes applying at least one from a common command set to the reduced separation layers to extract fields from the reduced separation layers. In some embodiments, each of the common command sets is independent of a specific field in a protocol layer.

在一些实施例中,所述方法包括来自处理的级联结果被加以级联从而形成令牌,其中所述令牌被用于数据包的进一步处理。In some embodiments, the method includes concatenating results from the processing to form a token, wherein the token is used for further processing of the data packet.

在一些实施例中,所述方法包括将位矢量应用到来自处理的结果从而形成针对哈希函数的输入,其中所述哈希函数的输出是标识数据包应当采用等价多径路由中的哪个等价多径路由的唯一签名。In some embodiments, the method includes applying the bit vector to a result from the processing to form an input to a hash function, wherein an output of the hash function is a unique signature identifying which of the equal-cost multi-path routes the data packet should take.

在另一方面,提供一种实施解析器引擎的方法。所述方法包括基于协议层将数据包的层进行分离从而使得数据包的协议层的每一个都分隔开。In another aspect, a method of implementing a parser engine is provided, wherein the method includes separating layers of a data packet based on a protocol layer such that each of the protocol layers of the data packet is separated.

所述方法还包括保持与协议层的每一个的层类型以及协议层的每一个所结束的位置的偏移有关的信息。在一些实施例中,与层类型有关的信息存储在第一阵列中,与偏移有关的信息存储在第二阵列中。The method also includes maintaining information about a layer type for each of the protocol layers and an offset of where each of the protocol layers ends. In some embodiments, information about the layer type is stored in a first array and information about the offset is stored in a second array.

所述方法还包括将数据包的协议层中任何具有大于预定大小的大小的协议层进一步分离为第一部分和第二部分,其中第一部分具有预定大小。预定大小为软件限定的。The method further includes separating any protocol layer of the data packet having a size greater than a predetermined size into a first portion and a second portion, wherein the first portion has the predetermined size. The predetermined size is software-defined.

所述方法还包括基于进一步的分离对信息进行更新。在一些实施例中,对信息进行更新包括:将与第一部分和第二部分的层类型有关的信息存储在第一阵列的序列元素中,并且将与第一部分和第二部分的偏移有关的信息存储在第二阵列的序列元素中。The method further includes updating the information based on the further separation.In some embodiments, updating the information includes storing information about layer types of the first portion and the second portion in sequence elements of the first array, and storing information about offsets of the first portion and the second portion in sequence elements of the second array.

所述方法还包括:基于确定第二部分具有大于预定大小的大小,对第二部分重复进一步分离的步骤和更新的步骤。The method further includes repeating the steps of further separating and updating for the second portion based on determining that the second portion has a size greater than a predetermined size.

所述方法还包括处理所有的分离层。在一些实施例中,在处理之前,将分离层的每一个归纳为通用格式。在一些实施例中,处理分离层包括从所归纳的层中提取数据。The method further comprises processing all of the separated layers. In some embodiments, prior to processing, each of the separated layers is summarized into a common format. In some embodiments, processing the separated layers comprises extracting data from the summarized layers.

在另一个方面,提供了一种实现网络交换机的方法。所述方法包括基于协议层对数据包进行解析,由此初始化第一阵列和第二阵列。在一些实施例中,解析数据包包括标识数据包中的每一层的层类型,将每一层的层类型存储在第一阵列中,标识数据包中每一层所结束的位置的偏移,并且将每一层所结束的位置的偏移存储在第二阵列中。在一些实施例中,所述方法包括将第一阵列和第二阵列存储在网络交换机的存储器中。In another aspect, a method for implementing a network switch is provided. The method includes parsing a data packet based on protocol layers, thereby initializing a first array and a second array. In some embodiments, parsing the data packet includes identifying a layer type for each layer in the data packet, storing the layer type for each layer in the first array, identifying an offset for a location where each layer ends in the data packet, and storing the offset for the location where each layer ends in the second array. In some embodiments, the method includes storing the first array and the second array in a memory of the network switch.

所述方法还包括:将第一阵列的每个元素与可编程寄存器进行比较,以确定与该元素相关联的层是否需要被分离。在一些实施例中,可编程寄存器包括:层类型(layerType)字段,其指示何者与相对应的输入相匹配;分离长度(splitLength)字段,其指示相对应的层应当以其而被分离的偏移;以及新层类型(newLayerType)字段,其指示新分离层的层类型值。在一些实施例中,在对数据包进行解析之前,该方法包括经由软件对层类型字段、分离长度字段以及新层类型字段进行编程。The method further includes comparing each element of the first array to a programmable register to determine whether the layer associated with the element needs to be separated. In some embodiments, the programmable register includes a layer type (layerType) field that indicates what matches the corresponding input; a split length (splitLength) field that indicates the offset at which the corresponding layer should be separated; and a new layer type (newLayerType) field that indicates the layer type value of the newly separated layer. In some embodiments, before parsing the packet, the method includes programming the layer type field, the split length field, and the new layer type field via software.

所述方法还包括,基于确定与该元素相关联的层需要被分离,来分离该层。The method also includes separating the layer based on determining that the layer associated with the element needs to be separated.

所述方法还包括:根据分离来对第一阵列和第二阵列进行更新,并且从与第一阵列的每个元素相关联的层提取数据。The method also includes updating the first array and the second array according to the separation and extracting data from a layer associated with each element of the first array.

在一些实施例中,所述方法包括将所提取的数据结合以由此形成最终结果。在一些实施例中,将位矢量应用到来自逻辑AND运算的结果,其中对来自层的所提取的数据以及位掩码应用逻辑AND运算中的每一个。In some embodiments, the method includes combining the extracted data to thereby form a final result. In some embodiments, the bit vector is applied to a result from a logical AND operation, wherein each of the logical AND operations is applied to the extracted data from the layer and the bit mask.

在另一个实施例中,提供一种解析器引擎。该解析器引擎包括:电路,其被配置为基于协议层对数据包的层进行分离,使得数据包的协议层的每一个被分隔开,进一步将数据包的协议层中具有大于预定大小的大小的每个协议层分离为多个层,并且对所有的分离层进行处理。In another embodiment, a parser engine is provided. The parser engine includes circuitry configured to separate layers of a data packet based on a protocol layer, such that each of the protocol layers of the data packet is separated, further separate each of the protocol layers of the data packet having a size greater than a predetermined size into a plurality of layers, and process all of the separated layers.

在一些实施例中,保持与协议层的每一个的层类型以及协议层的每一个所结束的位置的偏移有关的信息。在将数据包的协议层中具有大于预定大小的大小的每个协议层进一步分离为多个层后,对该信息进行更新。In some embodiments, information about the layer type of each of the protocol layers and the offset of the location where each of the protocol layers ends is maintained, and the information is updated after each protocol layer having a size greater than a predetermined size among the protocol layers of the data packet is further separated into a plurality of layers.

在一些实施例中,所述电路还被配置为:将来自处理的结果加以级联从而形成令牌,其中所述令牌被用于数据包的进一步处理。In some embodiments, the circuitry is further configured to concatenate results from the processing to form a token, wherein the token is used for further processing of the data packet.

在一些实施例中,所述电路还被配置为:将位矢量应用到来自处理的结果,以形成针对哈希函数的输入。In some embodiments, the circuitry is further configured to apply the bit vector to a result from the processing to form an input to the hash function.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

如附图所说明的,从以下关于本发明示例性实施例的更为具体的描述,前述内容将会变得明显,其中贯穿各个示图的相同的参考标号指代相同的部分。所列附图未必按照比例绘制,其关注点在于阐释本发明的实施例。The foregoing will become apparent from the following more particular description of exemplary embodiments of the present invention, as illustrated in the accompanying drawings, wherein like reference numerals refer to like parts throughout the various views. The accompanying drawings are not necessarily drawn to scale, with emphasis placed upon illustrating embodiments of the present invention.

图1图示了根据本发明的一些实施例的解析器引擎的方法。FIG1 illustrates a method of a parser engine according to some embodiments of the present invention.

图2图示了根据本发明的一些实施例的解析器引擎的另一方法。FIG2 illustrates another method of a parser engine according to some embodiments of the present invention.

图3图示了根据本发明的一些实施例的网络交换机的方法。FIG3 illustrates a method of a network switch according to some embodiments of the present invention.

具体实施方式DETAILED DESCRIPTION

在下面的描述中,列出了各种细节用于解释。然而,本领域的技术人员应当意识到,本发明可以无需使用这些特定的细节而实施。这样,本发明并不意在限于所示出的实施例,而是应当被赋予与这里所描述的原则和特征相一致的最宽广的范围。In the following description, various details are listed for explanation. However, those skilled in the art will appreciate that the present invention can be practiced without using these specific details. Thus, the present invention is not intended to be limited to the embodiments shown, but rather should be given the broadest scope consistent with the principles and features described herein.

用于处理大协议层的装置的实施例涉及一种优化字段选择电路的实施。这种实施在解析数据包时为硬件解析器引擎提供类似软件的灵活性。该实施限制每一层的大小并且将超过该大小的任何层分离为较小的层。解析器引擎如同从非分离层提取数据一样从分离的层提取数据并且接着将所提取的数据级联为最终的结果。An embodiment of an apparatus for processing large protocol layers involves an implementation of optimized field selection circuitry. This implementation provides a hardware parser engine with software-like flexibility when parsing packets. The implementation limits the size of each layer and separates any layer exceeding that size into smaller layers. The parser engine extracts data from the separated layers just as it would from a non-separated layer and then concatenates the extracted data into a final result.

例如网络交换机的网络设备能够对网络业务进行切换/路由。所述网络交换机包括至少一个输入/进入端口和至少一个输出/出去端口,用于接收和发送数据包。在一些实施例中,网络交换机还包括解析器和重写器。解析器可以包括一个或多个解析器引擎,以识别网络数据包的内容,并且重写器可以包括一个或多个重写引擎,以在数据包被从网络交换机发送出去之前对数据包进行修改。解析器引擎(多个解析器引擎)以及重写器引擎(多个重写器引擎)是灵活的并且在可编程的基础上进行操作。A network device, such as a network switch, is capable of switching/routing network traffic. The network switch includes at least one input/entry port and at least one output/egress port for receiving and sending data packets. In some embodiments, the network switch further includes a parser and a rewriter. The parser may include one or more parser engines to identify the content of network data packets, and the rewriter may include one or more rewrite engines to modify the data packets before they are sent from the network switch. The parser engine(s) and the rewriter engine(s) are flexible and operate on a programmable basis.

网络交换机还包括用于存储网络交换机所使用的数据的存储器。例如,存储器存储在实施中所使用的至少两个阵列,以保持对分离层的跟踪。对于另一个例子,存储器存储通用命令集合,以从协议头部中提取字段。对于又一个示例而言,存储器还存储计数和统计信息。The network switch also includes a memory for storing data used by the network switch. For example, the memory stores at least two arrays used in the implementation to keep track of the separation layer. In another example, the memory stores a set of common commands for extracting fields from protocol headers. In yet another example, the memory also stores counters and statistical information.

在以太网中,数据包包括多个协议层。每一个协议层承载不同的信息,一些公知的层的例子有:In Ethernet, a data packet consists of multiple protocol layers. Each protocol layer carries different information. Some well-known examples of layers are:

EthernetEthernet

PBB EthernetPBB Ethernet

ARPARP

IPV4IPV4

IPV6IPV6

MPLSMPLS

FCOEFCOE

TCPTCP

UDPUDP

ICMPICMP

IGMPIGMP

GREGRE

ICMPv6ICMPv6

VxLANVxLAN

TRILLTRILL

CNMCNM

理论上说,协议层可以按照任何的顺序出现。然而,仅会出现这些层的一些公知的组合。这些层的有效组合的一些例子有:Theoretically, the protocol layers can appear in any order. However, only certain well-known combinations of these layers can occur. Some examples of valid combinations of these layers are:

EthernetEthernet

Ethernet,ARPEthernet, ARP

Ethernet,CNMEthernet,CNM

Ethernet,FCoEEthernet,FCoE

Ethernet,IPV4Ethernet,IPV4

Ethernet,,IPV4,ICMPEthernet,,IPV4,ICMP

Ethernet,IPV4,IGMPEthernet,IPV4,IGMP

对于数据包解析操作,数据包被分解为层。这种分离是基于例如上面所列的公知的层来完成的。正如上面所解释的,在传统的硬件实施中,为了以可编程的方法从层中提取“T”总数字节,其中该层可以具有的大小为“L”字节,该层所需要的字节MUX的总数为T*(L:1)个MUX。由此,“L”越大,字段选择电路的大小就越大,这就增加了硬件成本。For packet parsing operations, packets are broken down into layers. This separation is based on well-known layers, such as those listed above. As explained above, in conventional hardware implementations, in order to programmatically extract "T" total bytes from a layer, where the layer may be of size "L" bytes, the total number of byte MUXs required for that layer is T*(L:1) MUXs. Consequently, the larger "L" is, the larger the field selection circuitry, which increases hardware cost.

当前的实施优化了解析器引擎的字段选择电路。当前的实施依赖于关于字节处理顺序的假定。典型地,解析器引擎的字节输出顺序与字节在进入层中出现的顺序相匹配。例如,如果将选择字节1、字节3和字节5,那么字节出现的顺序就是1、3、5,而不是3、1、5或5、3、1或任何其他这样的组合。基于这种假定,所需要的MUX的总数不再是T*(L:1),而是(L:1)+(L-1:1)+(L-2:1)+(L-3:1)+…+(T:1),假设T<L。The current implementation optimizes the field selection circuitry of the parser engine. The current implementation relies on an assumption about the order in which bytes are processed. Typically, the order in which bytes are output from the parser engine matches the order in which the bytes appear in the incoming layer. For example, if byte 1, byte 3, and byte 5 are to be selected, then the order in which the bytes appear is 1, 3, 5, not 3, 1, 5 or 5, 3, 1 or any other such combination. Based on this assumption, the total number of MUXs required is no longer T*(L:1), but (L:1)+(L-1:1)+(L-2:1)+(L-3:1)+…+(T:1), assuming T<L.

由于硬件的成本与层“L”的长度成正比,当前的实施限制了其所要支持的“L”的大小并且将任何超过长度“L”的层分离为N个较小的层。来自N个分离的层的信息如同解析器引擎从单一层中进行的提取一样而被提取并且接着被级联回到最终结果。所提取的数据可以用于形成令牌或哈希输入。示例性的从数据包的数据提取在提交于【日期】的名称为“AMethod of Extracting Data from Packets and An Apparatus thereof”的美国专利申请序列号No.【代理人案卷号XPL-02100】,以及提交于【日期】的名称为“A Method ofForming a Hash Input from Packet Contents and An Apparatus thereof”的美国专利申请序列号No.【代理人卷号XPL-02200】中有所讨论,其全部内容通过参考被并入于此。Because the cost of hardware is proportional to the length of a layer "L," current implementations limit the size of "L" they support and split any layer exceeding length "L" into N smaller layers. Information from the N separate layers is extracted just as the parser engine extracts from a single layer and then concatenated back into the final result. The extracted data can be used to form a token or hash input. Exemplary data extraction from packets is discussed in U.S. patent application Ser. No. [Agent Docket No. XPL-02100], filed on [date], entitled "A Method of Extracting Data from Packets and An Apparatus thereof," and U.S. patent application Ser. No. [Agent Docket No. XPL-02200], filed on [date], entitled "A Method of Forming a Hash Input from Packet Contents and An Apparatus thereof," both of which are incorporated herein by reference in their entireties.

当前的实施以降低的硬件成本有利地实现相同的功能。当前实施的序列可以被总结为:The current implementation advantageously achieves the same functionality at reduced hardware cost. The sequence of the current implementation can be summarized as:

(1)对进入数据包进行解析,并且标识每一个层的层类型以及每个层所结束的位置的偏移。该信息被存储在两个阵列中,即layerType[]和layerEndPtr[]。(1) Parse the incoming data packet and identify the layer type of each layer and the offset of the location where each layer ends. This information is stored in two arrays, layerType[] and layerEndPtr[].

(2)在解析结束时,将每一个layerType[]和可编程寄存器进行比较。所述可编程寄存器包括下述字段:(2) At the end of parsing, each layerType[] is compared with a programmable register. The programmable register includes the following fields:

layerType:指示相对应输入所匹配的层类型;layerType: indicates the layer type matched by the corresponding input;

splitLength:指示该层将被分离的位置的偏移;以及splitLength: an offset indicating where the layer will be split; and

newLayerType:指示新分离层的层类型值。newLayerType: indicates the layer type value of the new separated layer.

针对该比对的示例性的伪码如表1所示。An exemplary pseudo code for this comparison is shown in Table 1.

表1Table 1

解析器引擎为高度可配置的硬件解析器引擎,其就网络业务如何被解析提供类似软件的灵活性。图1图示了根据本发明的一些实施例的解析器引擎的方法100。解析器引擎是网络交换机的一部分并且标识网络数据包的内容。在步骤105,基于协议层将数据包的层进行分离,使得数据包的协议层的每一个都分隔开。数据包的每一个协议层的层类型存储在第一阵列中,即layerType[]。数据包的每一协议层结束的位置的偏移存储在第二阵列中,即layerEndzptr[]。The parser engine is a highly configurable hardware parser engine that provides software-like flexibility in how network traffic is parsed. FIG1 illustrates a method 100 of a parser engine according to some embodiments of the present invention. The parser engine is part of a network switch and identifies the contents of a network packet. In step 105, the layers of the packet are separated based on the protocol layer so that each of the protocol layers of the packet is separated. The layer type of each protocol layer of the packet is stored in a first array, layerType[]. The offset of where each protocol layer of the packet ends is stored in a second array, layerEndzptr[].

在步骤110,数据包的协议层中具有大于预定大小的大小的每个协议层被进一步分离为多个层。第一阵列和第二阵列基于进一步的分离。预定大小为软件限定的。At step 110, each protocol layer in the protocol layers of the data packet having a size greater than a predetermined size is further separated into a plurality of layers. The first array and the second array are based on the further separation. The predetermined size is software defined.

在步骤115,对所有的分离层进行处理。在一些实施例中,分离层的每一个被归纳为通用格式。从归纳的分离层的每一个选择内容。在一些实施例中,通用命令集合中的至少一个被应用到所归纳的分离层,由此从所归纳的分离层提取字段。在一些实施例中,通用命令集合中的每一个都与协议层中的特定字段无关。在一些实施例中,来自处理的结果被加以级联以形成令牌,所述令牌被用于数据包的进一步处理。可替代地,将位矢量应用到来自处理的结果以形成针对哈希函数的输入,其中所述哈希函数的输出是标识数据包应当采用等价多径路由中的哪个等价多径路由的唯一签名。At step 115, all separation layers are processed. In some embodiments, each of the separation layers is summarized into a common format. Content is selected from each of the summarized separation layers. In some embodiments, at least one of a set of common commands is applied to the summarized separation layers, thereby extracting fields from the summarized separation layers. In some embodiments, each of the set of common commands is independent of a specific field in a protocol layer. In some embodiments, the results from the processing are concatenated to form a token, which is used for further processing of the data packet. Alternatively, a bit vector is applied to the results from the processing to form an input to a hash function, wherein the output of the hash function is a unique signature that identifies which of the equal-cost multipath routes the data packet should take.

图2图示了根据本发明的一些实施例的解析器引擎的另一方法200。在步骤205,基于协议层将数据包的层进行分离,使得数据包的协议层的每一个都分隔开。2 illustrates another method 200 of a parser engine according to some embodiments of the present invention. At step 205, the layers of the data packet are separated based on the protocol layer, such that each of the protocol layers of the data packet is separated.

在步骤210,保持与协议层的每一个的层类型以及协议层的每一个所结束的位置的偏移有关的信息。与层类型有关的信息存储在第一阵列(例如,layerType[])中。与偏移有关的信息存储在第二阵列(例如,layerEndzptr[])中。In step 210, information about the layer type of each of the protocol layers and the offset of the location where each of the protocol layers ends is maintained. Information about the layer type is stored in a first array (e.g., layerType[]). Information about the offset is stored in a second array (e.g., layerEndzptr[]).

在步骤215,将数据包的协议层中任何具有大于预定大小的大小的协议层进一步分离为第一部分和第二部分,其中第一部分具有预定大小。预定大小为软件限定的。At step 215, any protocol layer in the protocol layer of the data packet having a size greater than a predetermined size is further separated into a first portion and a second portion, wherein the first portion has a predetermined size. The predetermined size is software-defined.

在步骤220,基于进一步的分离来对信息进行更新。将与第一部分和第二部分的层类型有关的信息存储在第一阵列的序列元素中。将与第一部分和第二部分的偏移有关的信息存储在第二阵列的序列元素中。At step 220, the information is updated based on the further separation. Information about the layer types of the first and second parts is stored in sequence elements of the first array. Information about the offsets of the first and second parts is stored in sequence elements of the second array.

在步骤225,基于确定第二部分具有大于预定大小的大小,对第二部分重复步骤215和步骤220;以及At step 225, based on determining that the second portion has a size greater than the predetermined size, repeating steps 215 and 220 for the second portion; and

在步骤230,处理所有的分离层。在一些实施例中,在步骤230之前,将分离层的每一个归纳为通用格式。在一些实施例中,处理分离层包括从所归纳的层中提取数据。All of the separated layers are processed at step 230. In some embodiments, each of the separated layers is reduced to a common format prior to step 230. In some embodiments, processing the separated layers includes extracting data from the reduced layers.

图3图示了根据本发明的一些实施例的网络交换机的方法300。在步骤305,基于协议层对数据包进行解析。根据解析,初始化第一阵列(例如,layerType[])和第二阵列(例如,layerEndzptr[])。当数据包被解析时,数据包中的每一层的层类型被标识并且存储在第一阵列中,数据包中每一层所结束的位置的偏移被标识并且存储在第二阵列中。第一阵列和第二阵列被存储在网络交换机的存储器中。FIG3 illustrates a method 300 for a network switch according to some embodiments of the present invention. At step 305, a packet is parsed based on protocol layers. Based on the parsing, a first array (e.g., layerType[]) and a second array (e.g., layerEndzptr[]) are initialized. As the packet is parsed, the layer type of each layer in the packet is identified and stored in the first array, and the offset of each layer in the packet is identified and stored in the second array. The first and second arrays are stored in the memory of the network switch.

在步骤310,将第一阵列的每个元素与可编程寄存器进行比较,以确定与该元素相关联的层是否需要被分离。可编程寄存器包括:层类型(layerType)字段,其指示何者与相对应的输入相匹配;分离长度(splitLength)字段,其指示相对应的层应当以其而被分离的偏离;以及新层类型(newLayerType)字段,其指示新分离层的层类型值。典型地,在步骤305之前,经由软件对层类型字段、分离长度字段以及新层类型字段进行编程。At step 310, each element of the first array is compared to a programmable register to determine whether the layer associated with the element needs to be separated. The programmable register includes: a layer type (layerType) field, which indicates what matches the corresponding input; a split length (splitLength) field, which indicates the offset at which the corresponding layer should be separated; and a new layer type (newLayerType) field, which indicates the layer type value of the newly separated layer. Typically, the layer type field, the split length field, and the new layer type field are programmed via software before step 305.

在步骤315,基于确定与该元素相关联的层需要被分离,来分离该层。At step 315 , based on determining that the layer associated with the element needs to be separated, the layer is separated.

在步骤320,根据分离,对第一阵列和第二阵列进行更新。At step 320 , the first array and the second array are updated according to the separation.

在步骤325,从与第一阵列的每个元素相关联的层提取数据。在一些实施例中,将所提取的数据结合以由此形成最终结果。可替代地,将位矢量应用到来自逻辑AND运算的结果,其中对来自层的所提取的数据和位掩码应用逻辑AND运算中的每一个。At step 325, data is extracted from the layer associated with each element of the first array. In some embodiments, the extracted data is combined to form a final result. Alternatively, the bit vector is applied to the result from a logical AND operation, wherein each logical AND operation is applied to the extracted data from the layer and the bit mask.

该实施依赖于这样一种假定,即解析器引擎的字节输出顺序与字节在进入层中出现的顺序相匹配,从而有利地优化解析器引擎的字段选择电路。任何超出预定大小的层被分离为较小的层。解析器引擎如同从非分离层提取数据一样从分离层提取数据并且接着将所提取的数据级联为最终结果。This implementation relies on the assumption that the order in which the bytes are output by the parser engine matches the order in which they appear in the incoming layer, thereby advantageously optimizing the field selection circuitry of the parser engine. Any layer that exceeds a predetermined size is split into smaller layers. The parser engine extracts data from the separated layer just as it would from a non-separated layer and then concatenates the extracted data into the final result.

本领域普通技术人员将会认识到,还存在其他的用途和优势。虽然参照多个特定细节对本发明进行了描述,但本领域普通技术人员应当认识到,本发明可以实施为其他的特定形式,而不会背离本发明的精神。由此,本领域普通技术人员将会理解到,本发明不限于前述的说明性细节,而应当由所附的权利要求来限定。Those skilled in the art will recognize that other uses and advantages exist. Although the present invention has been described with reference to numerous specific details, those skilled in the art will recognize that the present invention may be embodied in other specific forms without departing from the spirit of the invention. Thus, those skilled in the art will understand that the present invention is not limited to the foregoing illustrative details, but is defined by the appended claims.

Claims (32)

1.一种实施解析器引擎的方法,所述方法包括:1. A method of implementing a parser engine, the method comprising: 利用所述解析器引擎将数据包的头部进行分离,所述头部具有多个协议层,其中所述分离基于所述协议层,使得所述头部的所述协议层中的每个协议层都被分隔开;separating a header of a data packet using the parser engine, the header having a plurality of protocol layers, wherein the separation is based on the protocol layers such that each of the protocol layers of the header is separated; 利用所述解析器引擎将所述头部的所述协议层中具有大于预定大小的大小的每个协议层进一步分离为多个层子段;以及further separating, using the parser engine, each of the protocol layers of the header having a size greater than a predetermined size into a plurality of layer sub-segments; and 利用所述解析器引擎处理所有的所述子段。All of the sub-segments are processed using the parser engine. 2.根据权利要求1所述的方法,其中将数据包的层分离包括:将所述数据包的每个协议层的层类型存储在第一阵列中并且将所述数据包的每个协议层所结束的位置的偏移存储在第二阵列中。2. The method of claim 1 , wherein separating the layers of a data packet comprises storing a layer type of each protocol layer of the data packet in a first array and storing an offset of where each protocol layer of the data packet ends in a second array. 3.根据权利要求2所述的方法,其中进一步分离所述数据包的每个层包括:基于所述进一步的分离,更新所述第一阵列和所述第二阵列。3 . The method of claim 2 , wherein further separating each layer of the data packet comprises updating the first array and the second array based on the further separation. 4.根据权利要求1所述的方法,其中处理所有的所述子段包括:4. The method of claim 1 , wherein processing all of the sub-segments comprises: 将所述子段中的每一子段归纳为通用格式;以及reducing each of the sub-segments to a common format; and 从所归纳的子段中的每一子段选择内容。Content is selected from each of the summarized sub-segments. 5.根据权利要求4所述的方法,其中从所归纳的子段中的每一子段选择内容包括:将来自通用命令集合中的至少一个通用命令应用到所归纳的子段,以由此从所归纳的子段提取字段。5 . The method of claim 4 , wherein selecting content from each of the summarized subsegments comprises applying at least one general command from a set of general commands to the summarized subsegments to thereby extract fields from the summarized subsegments. 6.根据权利要求5所述的方法,其中所述通用命令集合中的每一个通用命令对所述协议层中的特定字段不可知。The method according to claim 5 , wherein each general command in the general command set is agnostic to a specific field in the protocol layer. 7.根据权利要求1所述的方法,进一步包括:级联来自所述处理的结果以形成令牌,其中所述令牌被用于所述数据包的进一步处理。7. The method of claim 1, further comprising concatenating results from the processing to form a token, wherein the token is used for further processing of the data packet. 8.根据权利要求1所述的方法,进一步包括:将位矢量应用到来自所述处理的结果,以形成针对哈希函数的输入。8. The method of claim 1, further comprising applying a bit vector to a result from the processing to form an input to a hash function. 9.根据权利要求1所述的方法,其中所述数据包具有本体,并且所述数据包的所述分离包括所述头部的分离,由此形成所述头部的分隔的部分,并且所述协议层的所述进一步的分离包括将所述头部的所述分隔的部分分离成子部分。9. The method of claim 1 , wherein the data packet has a body, and the separation of the data packet comprises separation of the header, thereby forming separated parts of the header, and the further separation of the protocol layer comprises separating the separated parts of the header into sub-parts. 10.一种实施解析器引擎的方法,所述方法包括:10. A method of implementing a parser engine, the method comprising: 利用所述解析器引擎将数据包的头部进行分离,所述头部具有多个协议层,其中所述分离基于所述协议层,使得所述头部的所述协议层中的每个协议层都被分隔开;separating a header of a data packet using the parser engine, the header having a plurality of protocol layers, wherein the separation is based on the protocol layers such that each of the protocol layers of the header is separated; 保持与所述协议层中的每个协议层的层类型以及所述协议层中的每个协议层所结束的位置的偏移有关的信息;maintaining information regarding a layer type for each of the protocol layers and an offset for a location at which each of the protocol layers ends; 将所述头部的所述协议层中任何具有大于预定大小的大小的协议层进一步分离为第一部分和第二部分,其中所述第一部分具有所述预定大小;further separating any of the protocol layers of the header having a size greater than a predetermined size into a first portion and a second portion, wherein the first portion has the predetermined size; 基于所述进一步的分离,对所述信息进行更新;updating the information based on the further separation; 基于确定所述第二部分具有大于所述预定大小的大小,对所述第二部分重复所述进一步分离的步骤和所述更新的步骤;以及repeating the further separating and updating steps for the second portion based on determining that the second portion has a size greater than the predetermined size; and 处理所有的所分离的层。All separated layers were processed. 11.根据权利要求10所述的方法,其中将与所述层类型有关的信息存储在第一阵列中,并将与所述偏移有关的信息存储在第二阵列中。The method of claim 10 , wherein the information about the layer type is stored in a first array and the information about the offset is stored in a second array. 12.根据权利要求11所述的方法,其中更新所述信息包括:12. The method of claim 11, wherein updating the information comprises: 将与所述第一部分和所述第二部分的层类型有关的信息存储在所述第一阵列的序列元素中;以及storing information about layer types of the first portion and the second portion in sequence elements of the first array; and 将与所述第一部分和所述第二部分的偏移有关的信息存储在所述第二阵列的序列元素中。Information about offsets of the first portion and the second portion is stored in sequence elements of the second array. 13.根据权利要求10所述的方法,进一步包括:在保持信息之前,软件限定所述预定大小。13. The method of claim 10, further comprising software defining the predetermined size before retaining the information. 14.根据权利要求10所述的方法,进一步包括:在处理之前,将所分离的层中的每一层归纳为通用格式。14. The method of claim 10, further comprising: prior to processing, reducing each of the separated layers to a common format. 15.根据权利要求14所述的方法,其中处理所分离的层包括从所归纳的层中提取数据。The method of claim 14 , wherein processing the separated layers comprises extracting data from the summarized layers. 16.一种实施网络交换机的方法,所述方法包括:16. A method of implementing a network switch, the method comprising: 对数据包的头部进行解析,所述头部具有多个协议层,其中所述解析基于所述协议层,由此分隔开所述头部的所述协议层的每一协议层并且初始化第一阵列和第二阵列;parsing a header of a data packet, the header having a plurality of protocol layers, wherein the parsing is based on the protocol layers, thereby separating each protocol layer of the protocol layers of the header and initializing a first array and a second array; 将所述第一阵列的每个元素与可编程寄存器进行比较,以确定与所述元素相关联的协议层中的一个协议层是否需要被分离;comparing each element of the first array with a programmable register to determine whether one of the protocol layers associated with the element needs to be separated; 基于确定与所述元素相关联的所述协议层中的所述一个协议层需要被分离,来分离所述协议层中的所述一个协议层;separating the one of the protocol layers based on determining that the one of the protocol layers associated with the element needs to be separated; 根据所述分离,对所述第一阵列和所述第二阵列进行更新;以及updating the first array and the second array according to the separation; and 从与所述第一阵列的每个元素相关联的所述协议层提取数据。Data is extracted from the protocol layer associated with each element of the first array. 17.根据权利要求16所述的方法,其中对数据包进行解析包括:17. The method according to claim 16, wherein parsing the data packet comprises: 标识所述数据包中的所述协议层中的每一协议层的层类型;Identifying a layer type of each of the protocol layers in the data packet; 将所述协议层中的每一协议层的所述层类型存储在所述第一阵列中;storing the layer type of each of the protocol layers in the first array; 标识所述数据包中所述协议层中的每一协议层所结束的位置的偏移;以及an offset identifying a location in the data packet where each of the protocol layers ends; and 将所述协议层中的每一协议层所结束的位置的所述偏移存储在所述第二阵列中。The offset of the location where each of the protocol layers ends is stored in the second array. 18.根据权利要求16所述的方法,其中所述可编程寄存器包括:18. The method of claim 16, wherein the programmable register comprises: 层类型字段,其指示何者与相对应的输入相匹配;A layer type field, which indicates which matches the corresponding input; 分离长度字段,其指示所述协议层中的相对应的协议层应当以其而被分离的偏移;以及a separation length field indicating an offset at which a corresponding one of the protocol layers should be separated; and 新层类型字段,其指示新分离层的层类型值。A new layer type field indicates the layer type value of the new separation layer. 19.根据权利要求18所述的方法,进一步包括:在对数据包进行解析之前,经由软件对所述层类型字段、所述分离长度字段以及所述新层类型字段进行编程。19. The method of claim 18, further comprising programming the layer type field, the separation length field, and the new layer type field via software before parsing the data packet. 20.根据权利要求16所述的方法,进一步包括:将所述第一阵列和所述第二阵列存储在所述网络交换机的存储器中。20. The method of claim 16, further comprising storing the first array and the second array in a memory of the network switch. 21.根据权利要求16所述的方法,进一步包括:将所提取的数据结合以由此形成最终结果。21. The method of claim 16, further comprising combining the extracted data to thereby form a final result. 22.根据权利要求16所述的方法,进一步包括:将位矢量应用到来自逻辑AND运算的结果,其中对来自所述协议层中的一个协议层的所提取的数据和位掩码应用所述逻辑AND运算中的每一个。22. The method of claim 16, further comprising applying a bit vector to results from logical AND operations, wherein each of the logical AND operations is applied to the extracted data and a bit mask from one of the protocol layers. 23.一种网络交换机,包括:23. A network switch comprising: 输入端口和输出端口,用于接收和发送数据包,所述数据包中的每个数据包具有包括多个协议层的头部;an input port and an output port for receiving and sending data packets, each of the data packets having a header including a plurality of protocol layers; 存储器,用于存储第一阵列和第二阵列以保持对所述协议层的跟踪;以及a memory for storing a first array and a second array to keep track of the protocol layers; and 解析器引擎,用于将数据包的头部分离为所述协议层,以用于将所述协议层中的任何超过预定大小的协议层进一步分离为多个子层,并且用于从所有的所述子层提取数据。A parser engine for separating the header of the data packet into the protocol layers, for further separating any of the protocol layers exceeding a predetermined size into a plurality of sub-layers, and for extracting data from all of the sub-layers. 24.根据权利要求23所述的网络交换机,其中所述预定大小是软件限定的。24. The network switch of claim 23, wherein the predetermined size is software defined. 25.根据权利要求23所述的网络交换机,其中所述解析器引擎将所提取的数据进一步级联以形成令牌,其中所述令牌被用于所述数据包的进一步处理。25. The network switch of claim 23, wherein the parser engine further concatenates the extracted data to form tokens, wherein the tokens are used for further processing of the data packets. 26.根据权利要求23所述的网络交换机,其中所述解析器引擎进一步:26. The network switch of claim 23, wherein the parser engine further: 对用于所述子层中的每个子层的所提取的数据以及位掩码应用逻辑AND运算;以及applying a logical AND operation on the extracted data and the bit mask for each of the sub-layers; and 将位矢量应用到来自所述逻辑AND运算的结果,以形成哈希函数的输入。The bit vector is applied to the result from the logical AND operation to form the input to the hash function. 27.根据权利要求26所述的网络交换机,其中所述哈希函数的输出是标识所述数据包应当采用等价多径路由中的哪个等价多径路由的唯一签名。27. The network switch of claim 26, wherein the output of the hash function is a unique signature that identifies which of the equal-cost multi-path routes the data packet should take. 28.一种解析器引擎,包括电路,所述电路被配置为:28. A parser engine comprising circuitry configured to: 对数据包的头部进行分离,所述头部具有多个协议层,其中所述分离基于所述协议层,使得所述头部的所述协议层中的每个协议层被分隔开;separating a header of a data packet, the header having a plurality of protocol layers, wherein the separation is based on the protocol layers such that each of the protocol layers of the header is separated; 将所述头部的所述协议层中具有大于预定大小的大小的每个协议层进一步分离为多个子层;以及further separating each of the protocol layers of the header having a size greater than a predetermined size into a plurality of sub-layers; and 处理所有的所述子层。All of the sub-layers are processed. 29.根据权利要求28所述的解析器引擎,其中保持与所述协议层中的每个协议层的层类型以及所述协议层中的每个协议层所结束的位置的偏移有关的信息。29. The parser engine of claim 28, wherein information is maintained regarding a layer type of each of the protocol layers and an offset of where each of the protocol layers ends. 30.根据权利要求29所述的解析器引擎,其中在将所述数据包的所述协议层中具有大于预定大小的大小的每个协议层进一步分离为多个子层后,对所述信息进行更新。30. The parser engine of claim 29, wherein the information is updated after each of the protocol layers of the data packet having a size greater than a predetermined size is further separated into a plurality of sub-layers. 31.根据权利要求28所述的解析器引擎,其中所述电路还被配置为将来自所述处理的结果加以级联以形成令牌,其中所述令牌被用于所述数据包的进一步处理。31. The parser engine of claim 28, wherein the circuitry is further configured to concatenate results from the processing to form tokens, wherein the tokens are used for further processing of the data packet. 32.根据权利要求28所述的解析器引擎,其中所述电路还被配置为:将位矢量应用到来自所述处理的结果,以形成针对哈希函数的输入。32. The parser engine of claim 28, wherein the circuitry is further configured to apply a bit vector to a result from the processing to form an input to a hash function.
HK16108890.6A 2014-06-19 2016-07-26 A method of handling large protocol layers for configurable extraction of layer information and an apparatus thereof HK1220832B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
US14/309,763 2014-06-19
US14/309,763 US10616380B2 (en) 2014-06-19 2014-06-19 Method of handling large protocol layers for configurable extraction of layer information and an apparatus thereof

Publications (2)

Publication Number Publication Date
HK1220832A1 HK1220832A1 (en) 2017-05-12
HK1220832B true HK1220832B (en) 2021-05-28

Family

ID=

Similar Documents

Publication Publication Date Title
US11258886B2 (en) Method of handling large protocol layers for configurable extraction of layer information and an apparatus thereof
KR102337513B1 (en) Method of forming a hash input from packet contents and an apparatus thereof
US8842672B2 (en) Systems and methods for modifying network packets to use unrecognized headers/fields for packet classification and forwarding
WO2015056095A1 (en) Packet parsing and key generation in a network device
US10397113B2 (en) Method of identifying internal destinations of network packets and an apparatus thereof
US9473601B2 (en) Method of representing a generic format header using continuous bytes and an apparatus thereof
CN105282134B (en) Method for extracting data from packet, network switch and parser
US20160246882A1 (en) Method and apparatus for generating parallel lookup requests utilizing a super key
HK1220832B (en) A method of handling large protocol layers for configurable extraction of layer information and an apparatus thereof
US9531848B2 (en) Method of using generic modification instructions to enable flexible modifications of packets and an apparatus thereof
WO2006085374A1 (en) Communication device
HK1220826B (en) A method of identifying internal destinations of network packets and an apparatus thereof
HK1219186B (en) A method of representing a generic format header using continuous bytes and an apparatus thereof
HK1220827B (en) A method of using bit vectors to allow expansion and collapse of header layers within packets for enabling flexible modifications and an apparatus thereof
HK1220834B (en) A method of modifying packets to a generic format for enabling programmable modifications and an apparatus thereof