WO2014146571A1 - 基于网络处理器的报文预处理方法、装置及网络处理器 - Google Patents

基于网络处理器的报文预处理方法、装置及网络处理器 Download PDF

Info

Publication number
WO2014146571A1
WO2014146571A1 PCT/CN2014/073643 CN2014073643W WO2014146571A1 WO 2014146571 A1 WO2014146571 A1 WO 2014146571A1 CN 2014073643 W CN2014073643 W CN 2014073643W WO 2014146571 A1 WO2014146571 A1 WO 2014146571A1
Authority
WO
WIPO (PCT)
Prior art keywords
packet
header
processing
header information
layer
Prior art date
Application number
PCT/CN2014/073643
Other languages
English (en)
French (fr)
Inventor
姜海明
谢密
刘建成
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
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2014146571A1 publication Critical patent/WO2014146571A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/22Parsing or analysis of headers

Definitions

  • Network processor-based message preprocessing method device and network processor
  • the present invention relates to the field of communications technologies, and in particular, to a network processor-based packet pre-processing method, apparatus, and network processor. Background technique
  • the main function of the network processor is the parsing and processing of the message. Specifically, the packet is parsed first, and the corresponding service process (such as Layer 2, Layer 3, or Multi-Protocol Label Switching of the Open System Interconnection (OSI)) is obtained. Then, jump to the corresponding business process, and the microcode residing in the microengine completes the processing of the text.
  • OSI Open System Interconnection
  • the parsing of the network processor is usually done by microcode.
  • the microcode reads the message header, compares the content of the packet with the preset conditions to obtain the corresponding business process, and the disadvantage of this is that the microcode instruction is very wasteful; and the microcode instruction space is the most valuable resource of the network processor. Therefore, there is a need for a message processing method that can save the microcode resources of the network processor. Summary of the invention
  • an embodiment of the present invention provides a network processor-based message preprocessing method, apparatus, and network processor.
  • a network processor-based message preprocessing method includes: Pre-establishing a correspondence between the header information and the pre-processing result;
  • the correspondence between the pre-established packet header information and the pre-processing result includes:
  • the header information is stored in a first memory, and the pre-processing result is stored in a second memory associated with the first memory.
  • the first memory is a triple content addressable memory (TCAM), and the second memory is a static memory (SRAM).
  • TCAM triple content addressable memory
  • SRAM static memory
  • the packet header information includes: packet header information processed by the Layer 2, packet header information processed by the Layer 3, packet header information processed by the MPLS, packet header information of the ARP Request protocol packet, and ARP.
  • the header information of the Layer 2 processing includes: a Layer 2 header of the packet, a VLAN, a frame type (EType), and a payload (ayload);
  • the header information of the Layer 3 processing includes: Layer 2 header of the packet, VLAN, EType, IP header, and payload;
  • the MPLS header information includes: Layer 2 header, VLAN, EType, IP header, and payload;
  • the header information of the ARP Request packet includes: Layer 2 header, EType, and payload.
  • the header information of the ARP Reply packet includes: Layer 2 header, EType, and payload; 802. lx protocol packet header Information includes: Layer 2 header, EType and payload.
  • the preprocessing result includes:
  • a service ID number Used to indicate whether the packet is sent to the CPU for processing the CPU tag; a service ID number used to indicate a microcode service flow for processing a message;
  • Header control information for providing microcode processing
  • the packet header control information includes a packet header type and a corresponding offset.
  • the parsing the determined pre-processing result and performing the corresponding processing according to the parsing result includes:
  • the packet header control information of the to-be-processed packet is sent to the corresponding microcode service processing module for processing according to the service ID number and the packet header control information in the pre-processed result.
  • the embodiment of the present invention further provides a network processor-based packet preprocessing apparatus, including: a corresponding module, configured to pre-establish a correspondence between a packet header information and a pre-processing result; the searching module is configured to be configured according to Processing a packet header of the packet, and searching for a packet header information that matches the packet header, and determining, according to the correspondence, a pre-processing result corresponding to the found packet header information;
  • the parsing processing module is configured to parse the determined pre-processing result, and perform corresponding processing according to the parsing result.
  • the corresponding module is configured to store the header information in a first memory and to store the pre-processing result in a second memory associated with the first memory.
  • the first memory is a TCAM
  • the second memory is an SRAM.
  • the packet header information includes: a packet header information processed by the layer 2, a packet header information processed by the layer 3, a packet header information processed by the MPLS, and a packet header of the ARP Request protocol packet. Information, the header information of the ARP Reply packet, and the header information of the 802.1x protocol packet;
  • the header information of the Layer 2 processing includes: Layer 2 header of the packet, VLAN, EType, and payload;
  • the header information of the Layer 3 processing includes: Layer 2 header of the packet, VLAN, EType, IP header, and payload;
  • the MPLS header information includes: Layer 2 header, VLAN, EType, IP header, and payload;
  • the header information of the ARP Request packet includes: Layer 2 header, EType, and payload;
  • the header information of the ARP Reply packet includes: Layer 2 header, EType, and payload;
  • the header information of the 802.xx protocol packet includes: Layer 2 header, EType, and payload.
  • the preprocessing result includes:
  • Header control information for providing microcode processing
  • the packet header control information includes a packet header type and a corresponding offset.
  • the parsing processing module includes:
  • the packet sending module is configured to send the to-be-processed message to the CPU for processing when the CPU is sent to the CPU in the determined pre-processing result.
  • the service process processing module is configured to send the packet header control information of the to-be-processed packet to the corresponding microcode service processing module for processing according to the service ID number and the packet header control information in the determined pre-processing result.
  • the embodiment of the invention further provides a network processor, comprising the packet preprocessing device described above.
  • the network processor-based packet preprocessing method, apparatus, and network processor provided by the embodiments of the present invention provide a lookup matching operation instead of a microcode instruction parsing message, and first solves the protocol packet.
  • the sending process causes the protocol message to be selected and sent to the CPU at the initial stage of the microcode processing, thereby reducing unnecessary microcode processing.
  • the packet type is parsed to determine the required entry.
  • the microcode processing flow solves the problem that the traditional network processor uses the microcode instruction to parse the message of the message; in addition, at the same time, the message is parsed
  • the header control information (message header type, offset) is taken and passed to the subsequent business process processing module, which makes the microcode more convenient to access the header, effectively reducing the instruction.
  • 1 is a schematic flowchart of a packet pre-processing method according to an embodiment of the present invention
  • FIG. 2 is a schematic structural diagram of a packet pre-processing apparatus according to an embodiment of the present invention.
  • FIG. 3 is a structural block diagram of an apparatus for implementing message preprocessing according to another embodiment of the present invention
  • FIG. 4 is a flowchart of an apparatus based on FIG. 3;
  • FIG. 5 is a diagram showing an example of preprocessing results according to an embodiment of the present invention.
  • FIG. 6 is a diagram showing an example of a preprocessing apparatus according to an embodiment of the present invention. detailed description
  • the network processor uses the microcode to parse the message, reads the message header step by step, compares the content of the message header with the preset condition, and gradually parses out the message type, and jumps to the corresponding business process flow.
  • the drawback of this method is that it requires a lot of microcode instructions to be used to complete the message parsing, and the microcode instruction space is the most valuable resource of the network processor.
  • the embodiment of the present invention provides a packet processor preprocessing method, device and network processor based on the network processor, and the correspondence between the matching condition and the service flow is established in advance, and the subsequent pre-preparation is performed.
  • the packet pre-processing can be performed directly by searching for a matching manner, and the microcode instruction is used to parse the packet, thereby saving microcode resources.
  • a network processor-based packet preprocessing method includes the following steps:
  • Step 11 Pre-establish the correspondence between the packet header information and the pre-processing result.
  • the header information may be stored in the first memory, and in the first
  • the pre-processing result is stored in a second memory associated with the memory.
  • the first memory may be a TCAM
  • the second memory may be an SRAM.
  • the preset condition of the Layer 2 processing is the Layer 2 header (the destination MAC is the non-gateway MAC) + VLAN (0 or more) + Frame Type (EType) + Payload (payload); Common Layer 3 processing presets
  • the condition is Layer 2 header (destination MAC is gateway MAC) + VLAN (0 or more) + EType (value 0x0800) + IP header + payload;
  • MPLS processing pre-condition is Layer 2 header (destination MAC is gateway MAC + VLAN (0 or more) + etherType (value 0x8847) + IP header + payload;
  • ARP Request protocol packet pre-condition is Layer 2 header (destination MAC is Oxffffffffffffffffff) + EType (value 0x0806) + Payload;
  • ARP Reply protocol packet pre-condition is Layer 2 header (destination MAC is rack MAC) + EType (value 0x0806) + payload; 802. lx protocol packet pre-condition is
  • the pre-processing result includes: an uplink CPU flag for indicating whether the packet is sent to the CPU for processing, a service ID number for indicating a microcode service flow for processing the message, and header control information for providing the microcode processing;
  • the packet header control information includes: a packet header type and a corresponding offset.
  • the CPU tag is mainly used for protocol packets that need to be sent to the CPU, such as ARP, OSPF, and 802.1x.
  • the microcode service process is the forwarding process that the packet needs to enter. Layer 2 and Layer 3 MPLS, etc.
  • the packet header control information refers to the header information required for microcode processing, including: which packet header types are included in the packet, and the starting offset information of each packet header type.
  • Step 12 Find, according to the packet header of the to-be-processed packet, the packet header information that matches the packet header.
  • Step 13 Determine, according to the correspondence, a pre-processing result corresponding to the found packet header information.
  • Step 12 and step 13 above according to the received packet header of the to-be-processed packet, find the matching packet header information in the TCAM, and find the matching packet header information, further in the SRAM.
  • the preprocessing method corresponding to the header information of the packet is found.
  • Step 14 Parse the determined pre-processing result, and perform corresponding processing according to the parsing result.
  • the corresponding processing is performed according to the parsing result, which may specifically include:
  • the packet header control information of the to-be-processed message is sent to the corresponding microcode service processing module for processing according to the service ID number and the packet header control information in the determined pre-processing result.
  • the first search and match operation (TCAM access) is used to solve the problem that the protocol packet is sent, so that the protocol packet is in the microcode.
  • the initial stage of processing is selected and sent to the CPU, which reduces unnecessary microcode processing.
  • the packet type is parsed, and the microcode processing flow that needs to be entered is determined, thereby solving the traditional NP utilization.
  • the instruction of the microcode instruction to parse the message wastes the problem; in addition, at the same time as the message parsing, the packet header control information (message header type, offset) is obtained and passed to the subsequent business process processing module, so that the microcode is more convenient to access. Baotou, effectively reduced the instructions.
  • an embodiment of the present invention further provides a network processor-based message pre-processing device and a network processor including the device.
  • the device includes:
  • Corresponding module 21 is configured to pre-establish a correspondence between the packet header information and the pre-processing result
  • the locating module 22 is configured to: according to the packet header of the to-be-processed packet, search for the packet header information that matches the packet header, and determine, according to the corresponding relationship, the pre-processing corresponding to the found packet header information. Result
  • the parsing processing module 23 is configured to parse the determined pre-processing result, and perform corresponding processing according to the parsing result.
  • the corresponding module 21 is further configured to store the packet in the first memory. Header information, and storing the pre-processing result in a second memory associated with the first memory.
  • the first memory may be a TCAM
  • the second memory may be an SRAM.
  • parsing processing module 23 may specifically include:
  • the packet sending module is configured to send a pending packet to the CPU when the CPU is sent to the CPU in the determined pre-processing result.
  • the service process processing module is configured to send the packet header control information of the to-be-processed packet to the corresponding microcode service processing module for processing according to the service ID number and the packet header control information in the determined pre-processing result.
  • the corresponding module, the search module, and the parsing processing module may be a central processing unit (CPU), a digital signal processor (DSP, or a digital signal processor) in a device that is preprocessed by a network processor-based message.
  • CPU central processing unit
  • DSP digital signal processor
  • FPGA Programmable Array
  • FIG. 3 is a structural block diagram of an apparatus for implementing message preprocessing according to another embodiment of the present invention. Referring to Figure 3, it can be seen that the device includes:
  • the key value assembling module 101 is configured to assemble a TCAM lookup table key value according to the message header, and send the key value to the message matching module 102.
  • the header matching module 102 includes a TC AM module 103 and an SRAM module 104 connected to the TC AM module, where:
  • the TCAM module 103 is configured to match the contents of the header with preset conditions pre-stored in the TCAM.
  • the SRAM module 104 is configured to return a match result stored in the SRAM associated with the TCAM.
  • the matching result processing module 105 is configured to parse the matching result returned by the packet matching module.
  • the packet sending module 106 is configured to send the packet to the CPU for processing according to requirements.
  • the service flow processing module 107 includes various service forwarding modules, such as Layer 2 forwarding, Layer 3 forwarding, and MPLS, and performs corresponding service forwarding processing according to the analysis result.
  • Figure 4 further shows a flow chart based on the apparatus shown in Figure 3, including:
  • Step 201 a beginning stage of the process
  • Step 202 Assemble and search for the key value of the TCAM, and read the first N bytes from the message header as a key value of the TCAM (here, N > 20 bytes);
  • Step 203 The TCAM matches the search key value and returns a lookup result in the SRAM, and the check result includes whether to send the CPU, the service ID, and the packet header control information;
  • Step 204 determining whether the CPU is required to be sent to the CPU according to the result of the lookup table: if the CPU flag is equal to 1, proceed to step 205; otherwise, proceed to step 206;
  • Step 205 Send the packet to the CPU for processing.
  • Step 206 Send the service according to the service ID to the corresponding microcode service processing flow
  • Step 207 the process ends.
  • FIG. 5 is a diagram showing an example of the pre-processing result of the embodiment of the present invention.
  • the message processing result is stored in the SRAM associated with the TCAM, and the content may include:
  • the service ID number is the preset service flow ID number.
  • the matching result processing module sends the message to the corresponding service flow processing module for processing according to the service ID.
  • An implementation of the embodiment of the present invention may have a correspondence between the following service ID numbers, where:
  • the header control information includes: the header type and the corresponding offset.
  • the header type is defined as follows:
  • Layer 2 header (destination MAC+ source MAC), length 12 bytes;
  • VLAN header length 4 bytes
  • EtherType Ethernet header type field, length 2 bytes
  • IP header length 20 bytes
  • the offset is relative to the start address of the packet header.
  • Fig. 6 shows an exemplary diagram of a preprocessing apparatus according to an embodiment of the present invention, illustrating an implementation of the preprocessing apparatus.
  • the left side of Figure 6 is the TCAM content, the schematic contains the first five entries; the right side is the associated SRAM, which stores the matching results.
  • the CPU is marked as 0; the traffic ID is 2 (L3 process); the header type is 1/2/3/5 (L2/VLAN/eType/IP respectively), and the offsets are respectively ( 0x0/0xc/0xl0/0xl2);
  • the destination MAC is a non-gateway MAC
  • the CPU is marked as 0; the traffic ID is 1 (L2 process); the header type is 1/2/3/5 (L2/vlan/eType/IP respectively), and the offsets are respectively ( 0x0/0xc/0xl0/0xl2);
  • the sending CPU is marked as 0; the traffic stream ID is 3 (MPLS flow); the header type includes 1/3/4/5 (L2/eType/label/IP respectively), and the offsets are respectively ( 0x0/0xc/0xe/0xl2);
  • the modules may be implemented in software for execution by various types of processors.
  • an identified executable code module can comprise one or more physical or logical blocks of computer instructions, which can be constructed, for example, as an object, procedure, or function. Nonetheless, the executable code of the identified modules need not be physically located together, but may include different instructions stored in different bits. When these instructions are logically combined, they form a module and implement the specifications of the module. purpose.
  • the executable code module can be a single instruction or a number of instructions, and can even be distributed across multiple different code segments, distributed among different programs, and distributed across multiple memory devices.
  • operational data may be identified within the module and may be implemented in any suitable form and organized within any suitable type of data structure. The operational data may be collected as a single data set, or may be distributed at different locations (including on different storage devices), and may at least partially exist as an electronic signal in a system or network On.
  • an embodiment of the present invention further provides a readable computer storage medium, the computer storage medium comprising a set of instructions, when executed, causing at least one processor to execute the network processor-based message described above Pretreatment method.
  • the module can be implemented by software, considering the level of the existing hardware process, the module can be implemented in software. Without considering the cost, a person skilled in the art can construct a corresponding hardware circuit to implement the corresponding function.
  • the hardware circuitry includes conventional Very Large Scale Integration (VLSI) circuits or gate arrays as well as existing semiconductors such as logic chips, transistors, or other discrete components.
  • VLSI Very Large Scale Integration
  • Modules can also be implemented with programmable hardware devices such as field programmable gate arrays, programmable array logic, programmable logic devices, and the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Communication Control (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明提供了一种基于网络处理器的报文预处理方法、装置及网络处理器,其中所述方法包括:预先建立报文头信息与预处理结果之间的对应关系;根据待处理报文的报文头,查找与所述报文头匹配的报文头信息;根据所述对应关系,确定查找到的报文头信息所对应的预处理结果;解析所确定的预处理结果,并根据解析结果执行对应的处理。

Description

基于网络处理器的报文预处理方法、 装置及网络处理器 技术领域
本发明涉及通信技术领域, 具体涉及一种基于网络处理器的报文预处 理方法、 装置及网络处理器。 背景技术
现今通信网络发展速度非常快, 网络流量的增长及新业务的出现, 需 要网络设备具有线速和灵活的处理能力。 网络处理器凭借其高速处理及灵 活的可编程性, 已成为当今网络中数据处理的有效解决方案。
网络处理器完成的主要功能就是报文的解析及处理。 具体地, 首先解 析报文, 获取其相应的业务流程(如开放式系统互连(OSI, Open System Interconnection )的二层、三层或多协议标签交换( MPLS, Multi-Protocol Label Switching )等), 然后跳转到相应的业务流程, 由驻留在微引擎中的微码完 成才艮文的处理。
网络处理器的解析工作通常由微码完成。 微码读取报文头, 将报文头 内容与预设条件比较获知其相应的业务流程, 这样做的不足是非常浪费微 码指令; 而微码指令空间是网络处理器最宝贵的资源。 因此, 亟需一种报 文处理方法, 能够节约网络处理器的微码资源。 发明内容
为解决现有存在的技术问题, 本发明实施例提供一种基于网络处理器 的报文预处理方法、 装置及网络处理器。
为解决上述技术问题, 本发明实施例提供方案如下:
一种基于网络处理器的报文预处理方法, 包括: 预先建立报文头信息与预处理结果之间的对应关系;
根据待处理报文的报文头, 查找与所述报文头匹配的报文头信息; 根据所述对应关系, 确定查找到的报文头信息所对应的预处理结果; 解析所确定的预处理结果, 并根据解析结果执行对应的处理。
上述方法中, 所述预先建立报文头信息与预处理结果之间的对应关系 包括:
在第一存储器中存储所述报文头信息, 以及在与所述第一存储器相关 联的第二存储器中存储所述预处理结果。
上述方法中, 所述第一存储器为三重内容可寻址存储器 (TCAM ), 所 述第二存储器为静态存储器 ( SRAM )。
上述方法中, 所述报文头信息包括: 二层处理的报文头信息、 三层处 理的报文头信息、 MPLS处理的报文头信息、 ARP Request协议报文的报文 头信息、 ARP Reply协议报文的报文头信息、 以及 802. lx协议报文的报文 头信息; 其中,
二层处理的报文头信息包括: 报文的二层头、 VLAN、 帧类型(EType ) 和净荷 ( ayload );
三层处理的报文头信息包括: 报文的二层头、 VLAN、 EType, IP头和 payload;
MPLS 处理的 ^艮文头信息包括: 二层头、 VLAN、 EType 、 IP 头和 payload;
ARP Request协议报文的报文头信息包括: 二层头、 EType和 payload; ARP Reply协议报文的报文头信息包括: 二层头、 EType和 payload; 802. lx协议报文的报文头信息包括: 二层头、 EType和 payload。
上述方法中, 所述预处理结果包括:
用于指示是否将报文上送 CPU处理的上送 CPU标记; 用于指示处理报文的微码业务流程的业务 ID号;
用于提供给微码处理的包头控制信息; 其中,
所述包头控制信息包括报文头类型及相应的偏移量。
上述方法中, 所述解析所确定的预处理结果, 并根据解析结果执行对 应的处理包括:
在所确定的预处理结果中的上送 CPU标记指示需要上送 CPU时,将所 述待处理报文上送 CPU处理; 以及,
才艮据所确定的预处理结果中的业务 ID号和包头控制信息, 将所述待处 理报文的包头控制信息发送给对应的微码业务处理模块进行处理。
本发明实施例还提供了一种基于网络处理器的报文预处理装置, 包括: 对应模块, 配置为预先建立报文头信息与预处理结果之间的对应关系; 查找模块, 配置为根据待处理报文的报文头, 查找与所述报文头匹配 的报文头信息, 并根据所述对应关系, 确定查找到的报文头信息所对应的 预处理结果;
解析处理模块, 配置为解析所确定的预处理结果, 并根据解析结果执 行对应的处理。
上述装置中, 所述对应模块, 配置为在第一存储器中存储所述报文头 信息, 以及在与所述第一存储器相关联的第二存储器中存储所述预处理结 果。
上述装置中, 所述第一存储器为 TCAM, 所述第二存储器为 SRAM。 优选地, 上述装置中, 所述报文头信息包括: 二层处理的报文头信息、 三层处理的报文头信息、 MPLS处理的报文头信息、 ARP Request协议报文 的报文头信息、 ARP Reply协议报文的报文头信息、 以及 802.1x协议报文 的报文头信息; 其中,
二层处理的报文头信息包括:报文的二层头、 VLAN、 EType和 payload; 三层处理的报文头信息包括: 报文的二层头、 VLAN、 EType、 IP头和 payload;
MPLS 处理的 ^艮文头信息包括: 二层头、 VLAN、 EType 、 IP 头和 payload;
ARP Request协议报文的报文头信息包括: 二层头、 EType和 payload;
ARP Reply协议报文的报文头信息包括: 二层头、 EType和 payload;
802. lx协议报文的报文头信息包括: 二层头、 EType和 payload。
上述装置中, 所述预处理结果包括:
用于指示是否将报文上送 CPU处理的上送 CPU标记;
用于指示处理报文的微码业务流程的业务 ID号;
用于提供给微码处理的包头控制信息; 其中,
所述包头控制信息包括报文头类型及相应的偏移量。
上述装置中, 所述解析处理模块包括:
报文上送模块, 配置为在所确定的预处理结果中的上送 CPU标记指示 需要上送 CPU时, 将所述待处理报文上送 CPU处理; 以及,
业务流程处理模块, 配置为根据所确定的预处理结果中的业务 ID号和 包头控制信息, 将所述待处理报文的包头控制信息发送给对应的微码业务 处理模块进行处理。
本发明实施例还提供了一种网络处理器, 包括上述的报文预处理装置。 从以上所述可以看出, 本发明实施例提供的基于网络处理器的报文预 处理方法、 装置及网络处理器, 提供查找匹配操作取代微码指令解析报文, 首先解决了协议报文上送的处理, 使协议报文在微码处理起始阶段就挑选 出来并上送 CPU, 减少了不必要的微码处理; 其次根据报文头, 解析出报 文类型, 确定其所需要进入的微码处理流程, 从而解决了传统网络处理器 利用微码指令进行报文解析的指令浪费问题; 另外, 在报文解析同时, 获 取了包头控制信息(报文头类型、 偏移)并传递给后面业务流程处理模块, 使得微码更加方便的访问包头, 有效缩减了指令。 附图说明 图 1为本发明实施例提供的报文预处理方法的流程示意图;
图 2为本发明实施例提供的报文预处理装置的结构示意图;
图 3为本发明另一实施例实现报文预处理的装置的结构框图; 图 4为基于图 3所示装置的流程图;
图 5为本发明实施例的预处理结果的一种示例图;
图 6为本发明实施例的预处理装置的一种示例图。 具体实施方式
为使本发明的目的、 技术方案和优点更加清楚, 下面将结合附图及具 体实施例对本发明进行详细描述。
通常, 网络处理器利用微码解析报文, 一步一步地读出报文头, 将报 文头的内容和预置条件比较, 逐步解析出报文类型, 并跳转到相应的业务 处理流程处理。 这种方法的弊端就是需要浪费很多的微码指令来完成报文 解析, 而微码指令空间是网络处理器最宝贵的资源。
为节约网络处理器的微码资源, 本发明实施例提供了一种基于网络处 理器的报文预处理方法、 装置及网络处理器, 通过预先建立好匹配条件和 业务流程的对应关系, 后续预处理过程中可以直接通过查找匹配的方式进 行报文预处理, 避免使用微码指令对报文进行解析, 从而可以节约微码资 源。
请参照图 1, 本发明实施例提供的基于网络处理器的报文预处理方法, 包括以下步骤:
步骤 11, 预先建立报文头信息与预处理结果之间的对应关系。
这里, 可以在第一存储器中存储所述报文头信息, 以及在与所述第一 存储器相关联的第二存储器中存储所述预处理结果。 具体地, 所述第一存 储器可以是 TCAM, 所述第二存储器可以是 SRAM。
具体地讲, 本实施例将报文头信息作为预置的匹配条件。 其中, 二层 处理的预置条件是二层头 (目的 MAC为非网关 MAC ) +VLAN ( 0个或多 个) +帧类型 (EType ) +净荷 (payload ); 普通三层处理的预置条件是二层 头(目的 MAC为网关 MAC ) +VLAN ( 0个或多个 ) + EType (值为 0x0800 ) +IP头 +payload; MPLS处理的预置条件是二层头(目的 MAC为网关 MAC ) +VLAN( 0个或多个)+etherType(值为 0x8847 )+IP头 +payload; ARP Request 协议报文的预置条件是二层头 (目的 MAC为 Oxffffffffffff ) +EType (值为 0x0806 ) +payload; ARP Reply协议报文的预置条件是二层头 (目的 MAC 为机架 MAC ) +EType (值为 0x0806 ) +payload; 802. lx协议报文的预置条 件是二层头(目的 MAC为 0x0180c2000003 )+EType(值为 0x888e )+payload。
预处理结果包括:用于指示是否将报文上送 CPU处理的上送 CPU标记、 用于指示处理报文的微码业务流程的业务 ID号、 用于提供给微码处理的包 头控制信息; 所述包头控制信息包括: 报文头类型及相应的偏移量。 其中, 上送 CPU标记主要针对一些需要上送 CPU的协议报文,如 ARP协议、 OSPF 协议、 802.1x协议等; 微码业务流程即为该报文需要进入的转发流程, 二 层、 三层、 MPLS等; 包头控制信息指提供给微码处理需要的包头信息, 包 括: 报文包含哪些报文头类型、 以及每种报文头类型的起始偏移信息。
步骤 12, 根据待处理报文的报文头, 查找与所述报文头匹配的报文头 信息。
步骤 13, 根据所述对应关系, 确定查找到的报文头信息所对应的预处 理结果。
上述步骤 12和步骤 13,根据接收到的待处理报文的报文头,在 TCAM 中查找匹配的报文头信息,查找到匹配的报文头信息之后,进一步在 SRAM 中查找到该报文头信息所对应的预处理方式。
步骤 14, 解析所确定的预处理结果, 并根据解析结果执行对应的处理。 这里, 根据解析结果执行对应的处理, 具体可以包括:
在所确定的预处理结果中的上送 CPU标记指示需要上送 CPU时,将待 处理报文上送 CPU处理; 以及,
根据所确定的预处理结果中的业务 ID号和包头控制信息, 将待处理报 文的包头控制信息发送给对应的微码业务处理模块进行处理。
从以上所述可以看出, 本发明实施例在网络处理器流水线引擎起始阶 段, 利用一次查找匹配操作(TCAM访问), 首先解决了协议报文上送的处 理, 使协议报文在微码处理起始阶段就挑选出来并上送 CPU, 减少了不必 要的微码处理; 其次根据报文头, 解析出报文类型, 确定其所需要进入的 微码处理流程,从而解决了传统 NP利用微码指令进行报文解析的指令浪费 问题; 另外, 在报文解析同时, 获取了包头控制信息(报文头类型、 偏移) 并传递给后面业务流程处理模块, 使得微码更加方便的访问包头, 有效缩 减了指令。
基于以上方法, 本发明实施例还提供了一种基于网络处理器的报文预 处理的装置以及包括该装置的网络处理器。 请参照图 2, 该装置包括:
对应模块 21, 配置为预先建立报文头信息与预处理结果之间的对应关 系;
查找模块 22, 配置为根据待处理报文的报文头, 查找与所述报文头匹 配的报文头信息, 并根据所述对应关系, 确定查找到的报文头信息所对应 的预处理结果;
解析处理模块 23, 配置为解析所确定的预处理结果, 并根据解析结果 执行对应的处理。
其中, 所述对应模块 21, 进一步配置为在第一存储器中存储所述报文 头信息, 以及在与所述第一存储器相关联的第二存储器中存储所述预处理 结果。 具体地, 所述第一存储器可以是 TCAM, 所述第二存储器可以是 SRAM。
这里, 所述解析处理模块 23具体可以包括:
报文上送模块, 配置为在所确定的预处理结果中的上送 CPU标记指示 需要上送 CPU时, 将待处理报文上送 CPU处理; 以及,
业务流程处理模块, 配置为根据所确定的预处理结果中的业务 ID号和 包头控制信息, 将待处理报文的包头控制信息发送给对应的微码业务处理 模块进行处理。
实际应用时, 对应模块、 查找模块及解析处理模块可由基于网络处理 器的报文预处理的装置中的中央处理器 (CPU, Central Processing Unit ), 数字信号处理器( DSP, Digital Signal Processor )或可编程逻辑阵列( FPGA, Field - Programmable Gate Array ) 实现。
图 3 则给出了本发明另一实施例实现报文预处理的装置的结构框图。 请参照图 3, 可以看出该装置包括:
键值组装模块 101, 配置为根据报文头组装 TCAM查表键值, 并将键 值送往报文匹配模块 102。
报头匹配模块 102,包含 TC AM模块 103及与 TC AM模块相连的 SRAM 模块 104, 其中:
TCAM模块 103, 配置为将包头内容与 TCAM中预先存储的预置条件 进行匹配。
SRAM模块 104, 配置为返回与 TCAM相关联的 SRAM中存放的匹配 结果。
匹配结果处理模块 105, 配置为解析报文匹配模块返回的匹配结果。 报文上送模块 106, 配置为根据需要将报文上送 CPU处理。 业务流程处理模块 107, 包含二层转发、 三层转发、 MPLS等各种业务 转发模块, 根据解析结果执行对应的业务转发处理。
图 4进一步给出了基于图 3所示装置的流程图, 包括:
步骤 201, 流程开始阶段;
步骤 202, 组装查找 TCAM的键值, 从报文头中读取前面 N个字节作 为查 TCAM的键值 (这里, N >20字节) ;
步骤 203, TCAM匹配查找键值并返回 SRAM中的查表结果, 查表结 果中包含是否上送 CPU、 业务 ID及包头控制信息;
步骤 204, 根据查表结果中上送 CPU标记判断是否需要上送 CPU: 如 果 CPU标记等于 1, 则进入步骤 205; 否则进入步骤 206;
步骤 205, 将报文上送 CPU处理;
步骤 206, 根据业务 ID送往相应的微码业务处理流程处理;
步骤 207, 流程结束。
图 5给出了本发明实施例的预处理结果的一种示例图, 其中, 报文处 理结果存放于与 TCAM相关联的 SRAM中, 内容可以包括:
1 )上送 CPU标记;
上送 CPU标记等于 1则上送 CPU (如协议报文); 否则,不上送 CPU。 2 )业务 ID号;
业务 ID号为预置的业务流 ID号。 匹配结果处理模块根据该业务 ID将 报文送至相应的业务流处理模块处理。 本发明实施例的一种实现中可以有 以下业务 ID号的对应关系, 其中:
1. 表示二层转发模块;
2. 表示三层转发模块;
3. 表示 MPLS转发模块;
以上所示的 ID号分配仅为举例说明, 并不作为本发明的任何限定。 3 ) 包头控制信息
包头控制信息包括: 报文头类型及相应的偏移量。 报文头类型定义如 下:
1. 二层头 (目的 MAC+源 MAC ) , 长度 12字节;
2. VLAN头, 长度 4字节;
3. EtherType, 以太头类型字段, 长度 2字节;
4. MPLS标签, 长度 4字节;
5. IP头, 长度 20字节;
这里, 偏移量是相对于包头起始地址而言的。
图 6给出了本发明实施例的预处理装置的一种示例图, 举例说明预处 理装置的实现。 其中, 图 6左边为 TCAM内容, 示意图中包含了前面 5个 条目; 右边为相关联的 SRAM, 存储匹配结果。
图 6中, 5个条目中分别为:
1. ARP Request协议才艮文
报文特征: 目的 MAC为全 1, etherType=0x0806;
匹配结果: 上送 CPU标记为 1 ;
2. ARP Reply协议报文
才艮文特征: 目的 MAC为网关 MAC, etherType=0x0806;
匹配结果: 上送 CPU标记为 1 ;
3. 三层单播报文
才艮文特征: 目的 MAC为网关 MAC, etherType=0x0800;
匹配结果: 上送 CPU标记为 0; 业务流 ID为 2 ( L3流程 ); 报文头类 型 包括 1/2/3/5 ( 分别 为 L2/VLAN/eType/IP ) , 偏移量分别 为 ( 0x0/0xc/0xl0/0xl2 ) ;
4. 二层单播报文 才艮文特征: 目的 MAC为非网关 MAC;
匹配结果: 上送 CPU标记为 0; 业务流 ID为 1 ( L2流程 ); 报文头类 型 包括 1/2/3/5 ( 分别 为 L2/vlan/eType/IP ) , 偏移量分别 为 ( 0x0/0xc/0xl0/0xl2 ) ;
5. MPLS标签包
报文特征: 目的 MAC为网关 MAC, etherType=0x8847;
匹配结果: 上送 CPU标记为 0; 业务流 ID为 3 ( MPLS流程 ) ; 报文 头类型包括 1/3/4/5 (分别为 L2/eType/label/IP ) , 偏移量分别为 ( 0x0/0xc/0xe/0xl2 ) ;
图 6中, 假设网关 MAC为 0x112233445566, 图 6中所有数字都是采 用十六进制的表示方式, 其中 *为掩码标记, 代表不关心其内容。
此说明书中所描述的许多功能部件都被称为模块, 以便更加特别地强 调其实现方式的独立性。
本发明实施例中, 模块可以用软件实现, 以便由各种类型的处理器执 行。 举例来说, 一个标识的可执行代码模块可以包括计算机指令的一个或 多个物理或者逻辑块, 举例来说, 其可以被构建为对象、 过程或函数。 尽 管如此, 所标识模块的可执行代码无需物理地位于一起, 而是可以包括存 储在不同位里上的不同的指令, 当这些指令逻辑上结合在一起时, 其构成 模块并且实现该模块的规定目的。
实际上, 可执行代码模块可以是单条指令或者是许多条指令, 并且甚 至可以分布在多个不同的代码段上, 分布在不同程序当中, 以及跨越多个 存储器设备分布。 同样地, 操作数据可以在模块内被识别, 并且可以依照 任何适当的形式实现并且被组织在任何适当类型的数据结构内。 所述操作 数据可以作为单个数据集被收集, 或者可以分布在不同位置上 (包括在不 同存储设备上), 并且至少部分地可以仅作为电子信号存在于系统或网络 上。
基于此, 本发明实施例还提供了一种可读计算机存储介质, 所述计算 机存储介质包括一组指令, 当执行所述指令时, 引起至少一个处理器执行 上述的基于网络处理器的报文预处理方法。
在模块可以利用软件实现时, 考虑到现有硬件工艺的水平, 所以可以 以软件实现的模块, 在不考虑成本的情况下, 本领域技术人员都可以搭建 对应的硬件电路来实现对应的功能, 所述硬件电路包括常规的超大规模集 成(VLSI ) 电路或者门阵列以及诸如逻辑芯片、 晶体管之类的现有半导体 或者是其它分立的元件。 模块还可以用可编程硬件设备, 诸如现场可编程 门阵列、 可编程阵列逻辑、 可编程逻辑设备等实现。
以上所述仅是本发明的实施方式, 应当指出, 对于本技术领域的普通 技术人员来说, 在不脱离本发明原理的前提下, 还可以作出若干改进和润 饰, 这些改进和润饰也应视为本发明的保护范围。

Claims

权利要求书
1. 一种基于网络处理器的报文预处理方法, 包括
预先建立报文头信息与预处理结果之间的对应关系;
根据待处理报文的报文头, 查找与所述报文头匹配的报文头信息; 根据所述对应关系, 确定查找到的报文头信息所对应的预处理结果; 解析所确定的预处理结果, 并根据解析结果执行对应的处理。
2. 如权利要求 1所述的方法, 其中, 所述预先建立报文头信息与预处 理结果之间的对应关系包括:
在第一存储器中存储所述报文头信息, 以及在与所述第一存储器相关 联的第二存储器中存储所述预处理结果。
3. 如权利要求 2所述的方法, 其中, 所述第一存储器为三重内容可寻 址存储器 TCAM, 所述第二存储器为静态存储器 SRAM。
4. 如权利要求 1所述的方法, 其中, 所述报文头信息包括: 二层处理 的报文头信息、 三层处理的报文头信息、 多协议标签交换 MPLS处理的报 文头信息、 ARP Request协议报文的报文头信息、 ARP Reply协议报文的报 文头信息、 以及 802.1x协议报文的报文头信息; 其中,
二层处理的报文头信息包括: 报文的二层头、 VLAN、 帧类型 EType 和净荷 ay load;
三层处理的报文头信息包括: 报文的二层头、 VLAN、 EType, IP头和 payload;
MPLS 处理的 ^艮文头信息包括: 二层头、 VLAN、 EType 、 IP 头和 payload;
ARP Request协议报文的报文头信息包括: 二层头、 EType和 payload; ARP Reply协议报文的报文头信息包括: 二层头、 EType和 payload; 802. lx协议报文的报文头信息包括: 二层头、 EType和 payload。
5. 如权利要求 4所述的方法, 其中, 所述预处理结果包括: 用于指示是否将报文上送 CPU处理的上送 CPU标记;
用于指示处理报文的微码业务流程的业务 ID号;
用于提供给微码处理的包头控制信息; 其中,
所述包头控制信息包括报文头类型及相应的偏移量。
6. 如权利要求 5所述的方法, 其中, 所述解析所确定的预处理结果, 并根据解析结果执行对应的处理包括:
在所确定的预处理结果中的上送 CPU标记指示需要上送 CPU时,将所 述待处理报文上送 CPU处理; 以及,
才艮据所确定的预处理结果中的业务 ID号和包头控制信息, 将所述待处 理报文的包头控制信息发送给对应的微码业务处理模块进行处理。
7. 一种基于网络处理器的报文预处理装置, 包括:
对应模块, 配置为预先建立报文头信息与预处理结果之间的对应关系; 查找模块, 配置为根据待处理报文的报文头, 查找与所述报文头匹配 的报文头信息, 并根据所述对应关系, 确定查找到的报文头信息所对应的 预处理结果;
解析处理模块, 配置为解析所确定的预处理结果, 并根据解析结果执 行对应的处理。
8. 如权利要求 7所述的装置, 其中, 所述对应模块, 配置为在第一存 储器中存储所述报文头信息, 以及在与所述第一存储器相关联的第二存储 器中存储所述预处理结果。
9. 如权利要求 8所述的装置, 其中, 所述第一存储器为 TCAM, 所述 第二存储器为 SRAM。
10. 如权利要求 7所述的装置, 其中, 所述报文头信息包括: 二层处理 的报文头信息、 三层处理的报文头信息、 MPLS 处理的报文头信息、 ARP Request协议报文的报文头信息、 ARP Reply协议报文的报文头信息、 以及 802.1x协议报文的报文头信息; 其中,
二层处理的报文头信息包括:报文的二层头、 VLAN、 EType和 payload; 三层处理的报文头信息包括: 报文的二层头、 VLAN、 EType, IP头和 payload;
MPLS 处理的 ^艮文头信息包括: 二层头、 VLAN、 EType 、 IP 头和 payload;
ARP Request协议报文的报文头信息包括: 二层头、 EType和 payload; ARP Reply协议报文的报文头信息包括: 二层头、 EType和 payload; 802. lx协议报文的报文头信息包括: 二层头、 EType和 payload。
11. 如权利要求 10所述的装置, 其中, 所述预处理结果包括: 用于指示是否将报文上送 CPU处理的上送 CPU标记;
用于指示处理报文的微码业务流程的业务 ID号;
用于提供给微码处理的包头控制信息; 其中,
所述包头控制信息包括报文头类型及相应的偏移量。
12. 如权利要求 11所述的装置, 其中, 所述解析处理模块包括: 报文上送模块, 配置为在所确定的预处理结果中的上送 CPU标记指示 需要上送 CPU时, 将所述待处理报文上送 CPU处理; 以及,
业务流程处理模块, 配置为根据所确定的预处理结果中的业务 ID号和 包头控制信息, 将所述待处理报文的包头控制信息发送给对应的微码业务 处理模块进行处理。
13. 一种网络处理器, 包括如权利要求 7至 12任一项所述的报文预处 理装置。
14. 一种可读计算机存储介质, 所述计算机存储介质包括一组指令, 当执行所述指令时, 引起至少一个处理器执行如权利要求 1至 6任一项所 述的基于网络处理器的报文预处理方法,
PCT/CN2014/073643 2013-03-18 2014-03-18 基于网络处理器的报文预处理方法、装置及网络处理器 WO2014146571A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310085936.4 2013-03-18
CN201310085936.4A CN103200084B (zh) 2013-03-18 2013-03-18 基于网络处理器的报文预处理方法、装置及网络处理器

Publications (1)

Publication Number Publication Date
WO2014146571A1 true WO2014146571A1 (zh) 2014-09-25

Family

ID=48722448

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/073643 WO2014146571A1 (zh) 2013-03-18 2014-03-18 基于网络处理器的报文预处理方法、装置及网络处理器

Country Status (2)

Country Link
CN (1) CN103200084B (zh)
WO (1) WO2014146571A1 (zh)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103200084B (zh) * 2013-03-18 2016-08-03 中兴通讯股份有限公司 基于网络处理器的报文预处理方法、装置及网络处理器
CN103986585B (zh) * 2014-05-13 2018-03-16 新华三技术有限公司 报文预处理方法及其装置
CN112217765B (zh) * 2019-07-10 2023-06-30 深圳市中兴微电子技术有限公司 报文解析方法和装置
CN111884948B (zh) * 2020-07-09 2022-08-12 烽火通信科技股份有限公司 一种流水线调度方法与装置

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101938457A (zh) * 2009-06-30 2011-01-05 华为技术有限公司 一种数据的处理方法及装置
CN102014065A (zh) * 2010-12-10 2011-04-13 中兴通讯股份有限公司 报文包头的解析方法、包头解析预处理装置和网络处理器
CN103200084A (zh) * 2013-03-18 2013-07-10 中兴通讯股份有限公司 基于网络处理器的报文预处理方法、装置及网络处理器

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102195977B (zh) * 2011-04-13 2014-07-23 北京恒光创新科技股份有限公司 一种网络协议识别方法及装置

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101938457A (zh) * 2009-06-30 2011-01-05 华为技术有限公司 一种数据的处理方法及装置
CN102014065A (zh) * 2010-12-10 2011-04-13 中兴通讯股份有限公司 报文包头的解析方法、包头解析预处理装置和网络处理器
CN103200084A (zh) * 2013-03-18 2013-07-10 中兴通讯股份有限公司 基于网络处理器的报文预处理方法、装置及网络处理器

Also Published As

Publication number Publication date
CN103200084B (zh) 2016-08-03
CN103200084A (zh) 2013-07-10

Similar Documents

Publication Publication Date Title
RU2735725C1 (ru) Способ и устройство обработки и отправки пакетов, узел pe и узел
US11979322B2 (en) Method and apparatus for providing service for traffic flow
CN114189473B (zh) 一种报文的发送方法和装置
CN105830406B (zh) 用于支持软件定义网络中的灵活查找关键字的方法、设备和系统
CN108809830B (zh) 一种实现OpenFlow的软件定义网络中报文排序的方法和网络设备
CN101573913B (zh) 用于多播路由选择的方法和设备
US9608833B2 (en) Supporting multiple multicast trees in trill networks
KR102054338B1 (ko) 개별 관리들을 이용하는 vlan 태깅된 패킷들의 가상 포워딩 인스턴스들의 원단 주소들로의 라우팅
US9628293B2 (en) Network layer multicasting in trill networks
US10530692B2 (en) Software FIB ARP FEC encoding
US20150023351A1 (en) Method and apparatus for performing link aggregation
US9954694B2 (en) Traffic black holing avoidance and fast convergence for active-active PBB-EVPN redundancy
US20090135833A1 (en) Ingress node and egress node with improved packet transfer rate on multi-protocol label switching (MPLS) network, and method of improving packet transfer rate in MPLS network system
US10791051B2 (en) System and method to bypass the forwarding information base (FIB) for interest packet forwarding in an information-centric networking (ICN) environment
US20190319871A1 (en) Multi-VRF Universal Device Internet Protocol Address for Fabric Edge Devices
CN108063718B (zh) 报文处理方法、装置及电子设备
US20180048593A1 (en) Flow entry generating and packet processing based on flow entry
US11956148B2 (en) Packet transmission method and device
WO2012075818A1 (zh) 报文包头的解析方法、包头解析预处理装置和网络处理器
WO2014146571A1 (zh) 基于网络处理器的报文预处理方法、装置及网络处理器
WO2021093463A1 (zh) 报文转发的方法、第一网络设备以及第一设备组
CN112491706B (zh) 数据报文的处理方法及装置、存储介质、电子装置
US11637775B2 (en) Methods and systems for location identifier based forwarding
US20230135615A1 (en) Mac-based routing
WO2016197933A2 (zh) 报文转发

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14770095

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14770095

Country of ref document: EP

Kind code of ref document: A1