WO2011116695A1 - Method and network processor for implementing multi-service forwarding - Google Patents

Method and network processor for implementing multi-service forwarding Download PDF

Info

Publication number
WO2011116695A1
WO2011116695A1 PCT/CN2011/072084 CN2011072084W WO2011116695A1 WO 2011116695 A1 WO2011116695 A1 WO 2011116695A1 CN 2011072084 W CN2011072084 W CN 2011072084W WO 2011116695 A1 WO2011116695 A1 WO 2011116695A1
Authority
WO
WIPO (PCT)
Prior art keywords
information
vlan
packet
port
forwarding
Prior art date
Application number
PCT/CN2011/072084
Other languages
French (fr)
Chinese (zh)
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 WO2011116695A1 publication Critical patent/WO2011116695A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/66Layer 2 routing, e.g. in Ethernet based MAN's
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/46Interconnection of networks
    • H04L12/4641Virtual LANs, VLANs, e.g. virtual private networks [VPN]

Definitions

  • the present invention relates to the field of data communications, and in particular, to a method and network processing for implementing multi-service forwarding, such as a common Layer 2, QinQ (802.1Qin802.1Q, VLAN dual stacking) service, and an L2 VPN (Virtual Private Network). Device.
  • multi-service forwarding such as a common Layer 2, QinQ (802.1Qin802.1Q, VLAN dual stacking) service, and an L2 VPN (Virtual Private Network).
  • MPLS Multiprotocol Label Switching
  • L2 VPN Layer 2 VPN
  • VPLS Virtual Private LAN Service
  • VPWS Virtual Private Wire Service
  • VPLS can provide multi-point to multi-point VPN technology.
  • VPWS provides point-to-point Layer 2 VPN technology. Due to its different technologies, it is reflected in the forwarding process.
  • L2 VPN access modes are various, such as port-based access, port-based and VLAN-based access, port-based, and two-layer VLAN (Virtual Local Area Network) access.
  • the network processor needs to implement multiple access and forwarding of L2VPN in a limited instruction space, and must implement basic Layer 2 forwarding and QinQ services at the same time.
  • the L2 VPN technology and the common Layer 2 forwarding and the QinQ implementation are processed separately. Different entries need to be designed for different services. At the same time, different forwarding processing flows are designed, which not only greatly consumes resources. Moreover, because the service is differentiated and processed, the instruction space is wasted, which greatly affects the performance of the network processor, and also imposes a burden on the control plane. At the same time, because different services are handled differently, it is very difficult to require service expansion, which seriously affects the scalability and compatibility of network processor function implementation.
  • the object of the present invention is to provide a method for implementing multi-service forwarding and a network processor, which abstracts and integrates the forwarding tables of the above three services by abstracting the common Layer 2 services, QinQ services, and L2 VPN services.
  • the forwarding process of the above three services is designed as a process, which greatly saves the network processor instruction space and table item resources, reduces the burden on the control layer, and improves scalability and compatibility.
  • the present invention provides a method for implementing multi-service forwarding, including:
  • the virtual local area network (VLAN) information carried in the packet is parsed according to the service configuration.
  • VLAN virtual local area network
  • the packet is sent to the discovered destination port or the port corresponding to the forwarding identifier according to the search result.
  • the step of searching for the forwarding identifier according to the access port information of the packet and the VLAN information includes:
  • the access port information and the Layer 2 VLAN information are calculated as a hash value according to a specific hash algorithm
  • the step of searching for the forwarding identifier according to the access port information and the VLAN information of the text further includes:
  • the forwarding identifier is searched in the pre-configured second mapping table according to the access port information and the outer VLAN information.
  • the step of searching for the forwarding identifier according to the access port information of the packet and the VLAN information includes:
  • the packet carries a layer of VLAN information or no VLAN information according to the service configuration, according to the access port information and the layer of VLAN information, or according to the access end
  • the port information and the default VLAN information of the access port are used to look up the forwarding identifier in the pre-configured second mapping table.
  • the above method further includes:
  • the MAC address table And searching, in the MAC address table, the information corresponding to the source MAC address information and the forwarding identifier carried in the packet, if the information corresponding to the source MAC address information and the forwarding identifier carried in the document is not found. Or, the information corresponding to the source MAC address information and the forwarding identifier carried in the document is found, but the discovered port information or the virtual port information is different from the access port information or the virtual port information of the packet, and then the MAC is performed. Address learning, filling source MAC address information, the forwarding identifier, and the access terminal information or virtual port information into the MAC address table.
  • the present invention further provides a network processor, comprising: a configuration module, configured to: after receiving the service configuration information input by the user, the port information and the VLAN information in the service configuration information Mapping to a forwarding identifier, and establishing a mapping table; the parsing module is configured to: after receiving the packet, parse the VLAN information carried by the packet according to the service configuration information of the configuration module, and parse the The output VLAN information is output to the search module.
  • a configuration module configured to: after receiving the service configuration information input by the user, the port information and the VLAN information in the service configuration information Mapping to a forwarding identifier, and establishing a mapping table
  • the parsing module is configured to: after receiving the packet, parse the VLAN information carried by the packet according to the service configuration information of the configuration module, and parse the The output VLAN information is output to the search module.
  • a locating module configured to: search for a forwarding identifier in the mapping table according to the received VLAN information and the access port information of the packet, and then, according to the found forwarding identifier and the destination MAC information carried by the packet Finding the information of the destination port in the MAC address table, and outputting the search result message to the forwarding module;
  • a forwarding module configured to send the packet to the discovered destination port or the port corresponding to the forwarding identifier according to the received search result message.
  • the configuration module is configured to establish a mapping table by: if the VLAN information in the service configuration information is Layer 2 VLAN information, calculating the port information and the Layer 2 VLAN information according to a hash algorithm. a first hash value, configured with a forwarding identifier for the first hash value, to establish a first mapping table; if the VLAN information in the service configuration information is a layer of VLAN information or no VLAN information, the port is The information and the layer of VLAN information, or the port information and the default VLAN information are mapped into a forwarding identifier, and a second mapping table is established.
  • the parsing module is configured to input the parsed VLAN information by:
  • the query module is configured to: if the VLAN information carried in the packet is the Layer 2 VLAN information, calculate the access port information and the Layer 2 VLAN information carried in the packet according to the hash algorithm. a second hash value, the second hash value is output to the lookup module; the lookup module is configured to look up a forwarding identifier in the first mapping table according to the received second hash value.
  • the searching module is further configured to: look up the forwarding identifier by: if the forwarding identifier is not found in the first mapping table according to the second hash value, according to the access port information and The layer VLAN information looks up the forwarding identifier in the second mapping table.
  • the parsing module is further configured to: output the parsed VLAN information to the searching module by: if the VLAN information carried in the packet is a layer of VLAN information or no VLAN information, Outputting a layer of VLAN information carried in the packet or outputting the default VLAN information of the access port to the searching module;
  • the locating module is further configured to: search for the forwarding identifier according to the access port information and the layer of VLAN information carried by the packet, or according to the information about the access port and the lack of the access port.
  • the federal VLAN information looks up the forwarding identifier in the second mapping table.
  • the network processor further includes a learning module
  • the locating module is further configured to: search, in the MAC address table, information corresponding to the source MAC address information carried by the packet and the forwarded identifier that is found, if the information is not found.
  • the learning module is configured to: after receiving the message output by the searching module, perform MAC address learning, the source MAC address information carried in the document, the forwarding identifier found by the searching module, and the access port information or virtual port The information learns the MAC address table.
  • the method and the network processor for implementing the multi-service forwarding provided by the present invention uniformly map the key factors of the Layer 2 service forwarding to the internal forwarding identifier, and the ordinary Layer 2 service, QinQ.
  • the service and L2 VPN services are designed with the same entries, and the same forwarding processing flow is designed at the same time, which saves resources and greatly optimizes the scalability and compatibility of the network processor.
  • FIG. 1 is a schematic diagram of a network processor according to an embodiment of the present invention.
  • FIG. 2 is a flow chart of a method for forwarding multi-service messages according to an embodiment of the present invention. Preferred embodiment of the invention
  • the core of the Layer 2 service, the single-layer VLAN and the double-layer VLAN in the QinQ service, and the VPN ID in the L2 VPN service are the key factors for the above three types of service forwarding.
  • the core idea of the present invention is to abstract the above key factors. It is mapped to the internal forwarding identifier FID.
  • FID forwarding identifier
  • the forwarding destination address is searched for the destination MAC address (DMAC) address and FID carried in the unified Layer 2 service, QinQ service, and VPLS service.
  • the VPWS directly forwards the packet according to the FID. .
  • the network processor of this embodiment includes: a configuration module, a parsing module, a searching module, a learning module, and a forwarding module.
  • the configuration module is configured to: after receiving the service configuration information input by the user, mapping port information and VLAN information of various services configured by the user into a forwarding identifier FID.
  • the FID can be implemented by mapping the FID through the port and the layer of the VLAN.
  • the FID is directly used by the port and the two-layer VLAN.
  • the port and the two-layer VLAN can be first calculated into a HASH value by a hash (HASH) algorithm, and then the HASH value and the FID are mapped.
  • HASH hash
  • VLAN Y1 has ports XI and X2. Ports XI, X2, and VLAN Y1 in the table apply for the same FID, all of which are Nl. .
  • the user-configured information includes: user-side port, network-side port, inner-layer VLAN, and outer VLAN, and the network-side port is configured to resolve two-layer VLAN.
  • the specific mapping is: For the user side, apply for an FID based on the port and inner VLAN, for the network side root The FID is applied according to the port and the two-layer VLAN. The two FID values are the same. Assume that the user-side port is X3, the network-side port is X4, the inner-layer VLAN is Y2, and the outer VLAN is Y3. As shown in Table 1, the FID of port X3 and VLAN Y2 is N2, and the network-side port X4 and VLAN Y2. The VLAN Y3 calculates the HASH value M1 through the HASH algorithm. As shown in Table 2, Ml and N2 are filled into the table.
  • the same FID is configured in the same VPN, as shown in Table 1, assuming port X5. And VLAN Y5 accesses VPN 1, port X6 and VLAN Y6 also access VPN 1, and the FID of the same VPN access request is N3.
  • VPWS there are also three types of VPWS access, through ports, ports, and a layer of VLANs or ports and two layers of VLANs. If port ⁇ 7 and VLAN Y7 are configured to access, apply FID N4 and the VPWS position in the table is 1 to indicate VPWS. If you configure port X8, VLAN Y8, and VLAN Y9 to access VPWS, calculate HASH value M3 based on port X8, VLAN Y8, and VLAN Y9, and apply FID N6 to the table.
  • the parsing module is configured to: when receiving the packet, according to the service configuration of the configuration module The information is parsed out of the VLAN information carried in the packet, and the VLAN information is output to the searching module.
  • the format of the general message is: destination MAC (DMAC) + source MAC (SMAC) + VLAN tag (flag) + ETYPE + PAYLOAD, where PAYLOAD indicates the content of the message, ETYPE is the Ethernet type.
  • the parsing module can parse the packet carried by the VLAN tag in the packet format.
  • the VLAN information may carry Layer 2 VLAN information, or may carry a layer of VLAN information or do not carry VLAN information.
  • the locating module is configured to: look up the forwarding identifier FID in the pre-configured mapping table according to the VLAN information carried in the packet and the port information of the packet, and then use the FID and the destination MAC address carried in the packet in the MAC address. The information in the table is searched for the destination port, and the search result message is output to the forwarding module.
  • the port information carried in the packet and the two-layer VLAN are calculated into a HASH value by using the same HASH algorithm as that configured by the configuration module, and the calculated HASH value is obtained.
  • For packets carrying a layer of VLAN directly use the port information and VLAN information to check the mapping.
  • For the packets without VLANs use the port information and the default VLAN information of the port to check the mapping table. For example, if the corresponding FID is not found, the corresponding FID is not configured. abandoned.
  • the lookup module searches the multi-service MAC address table according to the found FID and the destination MAC information of the packet (as shown in Table 3). If the corresponding information of the destination MAC and the FID can be found in Table 3, the destination port information corresponding to the destination MAC and the FID can be found, and then the result message of the destination port is output to the forwarding module; If the corresponding information of the MAC and the FID is not found, the result message that the destination port is not found is output to the forwarding module.
  • the forwarding module is configured to send the message to the port corresponding to the FID after receiving the search result message. Specifically, if the forwarding module receives the result message of finding the destination port, the forwarding module sends the message to the found destination port.
  • the forwarding module receives the result message that the destination port is not found, the packet is directly If the port is the normal Layer 2 service, the port corresponding to the FID is the port in the VLAN. If the L2 VPN service is used, the port corresponding to the FID is the local member and the remote member of the VPN. For the VPWS service, it is directly forwarded according to the port corresponding to the FID.
  • the network processor of this embodiment further includes a learning module
  • the locating module is further configured to: search, in the MAC address table, source MAC address information carried by the packet and corresponding information of the FID, where the corresponding information is: and source MAC address information, FID, and access port information or The information corresponding to the virtual port information is completely matched. If the information corresponding to the source MAC address information and the FID is not found, or the information corresponding to the source MAC address information and the FID is found, but the found port information or the virtual port information and the report are found. If the access port information or the virtual port information of the file is different, a message is output to the learning module;
  • the learning module is configured to learn the MAC address, learn the SMAC address, the FID and the access port information or the virtual port information to learn the multi-service MAC address table after receiving the message output by the search module.
  • the network processor receives various services configured by the user, and configures port information and VLAN information into a forwarding identifier FID in advance, and establishes port information and VLAN information. Mapping table with FID - mapping. As shown in the figure, the method for forwarding a multi-service text in this embodiment includes the following steps:
  • S110 The network processor receives the packet.
  • the network processor parses the VLAN information carried in the packet according to the service configuration.
  • S130 Search for a pre-configured forwarding identifier FID according to the port information and the carried VLAN information.
  • Packets of the common Layer 2 service, QinQ service, and L2 VPN service may be carried.
  • a Layer 2 VLAN tag it may carry a layer of VLAN tags or do not carry VLAN tags.
  • the FID can be mapped through the port and the two-layer VLAN.
  • a hash (HASH) algorithm calculates the port and the two layers of VLANs into a HASH value, and then maps the HASH value and the FID.
  • HASH hash
  • step S131 the network processor first determines that the packet carries the VLAN information in the process of parsing the packet. If the packet carries the two-layer VLAN, the process proceeds to step S132, if the packet does not carry the VLAN or only If a layer of VLAN is carried, the process proceeds to step S133.
  • step S132 using the HASH algorithm used in the configuration, calculating the HASH value by using the port information and the two layers of VLAN information carried in the text, and searching for a pre-configured HASH value and FID mapping table according to the calculated HASH value (for example, Table 2). If the FID corresponding to the HASH value is found, the process proceeds to step S140. If the FID corresponding to the HASH value is not found, the process proceeds to step S133.
  • step S140 it is determined whether it is VPWS access, if yes, the process goes to step S180, and if not, the process goes to step S150.
  • mapping table for example, Table 1 or Table 2
  • the query flag is the query flag
  • VPWS entries for example, the entry in Table 1 or Table 2 marked as VPWS is set to "1", indicating that the message is VPWS access.
  • step S150 Search for the multi-service MAC table according to the source MAC and the FID that are carried in the packet. If the information corresponding to the source MAC address information and the FID is not found, or the source MAC address information and the information corresponding to the FID are found, If the found port information or the virtual port information is different from the access port information or the virtual port information of the packet, the process proceeds to step S160, otherwise, the process proceeds to step S170.
  • S160 The SMAC address, the FID, and the access port or the virtual port information are learned into the multi-service MAC address table.
  • S170 Search for the multi-service MAC table according to the DMAC carried in the packet and the FID found. If the destination port information is found in the multi-service MAC table, the packet is forwarded to the found destination port, otherwise the process proceeds to step S180.
  • the packet is broadcasted on the port corresponding to the FID. If the packet is a common Layer 2 service and a QinQ service, the broadcast port corresponding to the FID found in the multi-service MAC address is corresponding to the common Layer 2 service and the QinQ service. If the port is a VPWS service, only one destination port in the FID found in the multi-service MAC table is forwarded directly through the destination port; if it is a VPLS service, the multi-service MAC table is searched. The broadcast port corresponding to the FID is the local member and remote member of the VPN.
  • the present invention uniformly maps the key factors of the Layer 2 service forwarding to the internal forwarding identifier, and designs the same entries for the common Layer 2 service, the QinQ service, and the L2 VPN service, and designs the same forwarding at the same time.
  • the processing flow saves resources and greatly optimizes the performance of the network processor's scalability and compatibility.

Abstract

Disclosed are a method and a network processor for implementing multi-service forwarding. The method includes: after receiving a message, analyzing the virtual local area network (VLAN) information carried in the message according to the service configuration; searching for a forwarding identification according to the access port information of the message and the VLAN information; according to the destination media access control (MAC) address information and the forwarding identification carried in the message, searching the MAC address table for the information of the destination port; according to the search result, transmitting the message to the found destination port or the port corresponding to the forwarding identification. By integrating and abstracting the ordinary 2-layer (L2) service, the 802.1Q in 802.1Q (QinQ) service and the L2 virtual private network (VPN) service, abstracting and integrating the forwarding tables of the three kinds of the service, and designing the forwarding processes of the three kinds of the service in one process, the invention greatly saves the instruction space and list item resources of the network processor, reduces the load of the control plane, and improves the extensibility and compatibility.

Description

一种实现多业务转发的方法和网络处理器  Method and network processor for realizing multi-service forwarding
技术领域 Technical field
本发明涉及数据通信领域, 尤其涉及一种实现普通二层、 QinQ ( 802.1Qin802.1Q , VLAN 双堆叠技术) 业务和 L2 VPN ( Virtual Private Network, 虚拟私有网络)等多业务转发的方法和网络处理器。  The present invention relates to the field of data communications, and in particular, to a method and network processing for implementing multi-service forwarding, such as a common Layer 2, QinQ (802.1Qin802.1Q, VLAN dual stacking) service, and an L2 VPN (Virtual Private Network). Device.
背景技术 Background technique
网络高速发展的今天, 网络处理器凭借其灵活的可编程性和高处理性能 得到越来越广泛的应用。 网络处理器需要在有限的指令空间和有限的资源限 制下实现多种业务。 目前 MPLS (Multiprotocol Label Switching, 多协议标记交 换) VPN业务已经越来越广泛的应用到现网中,基于 MPLS的 L2 VPN (二层 VPN ) 有 VPLS(Virual Private LAN Service , 虚拟专用局域网业务) 和 VPWS( Virtual Private Wire Service,虚拟专用线路业务)两类。其中 VPLS能够 提供多点到多点的二层 VPN技术, VPWS提供点到点的二层 VPN技术, 由 于其技术不同, 体现在转发流程上有较大区别。 同时 L2 VPN的接入方式有 多种, 如基于端口接入、 基于端口和 VLAN接入、 基于端口和两层 VLAN ( Virtual Local Area Network, 虚拟局域网)接入等。 网络处理器需要在有限 的指令空间中实现 L2VPN多种接入和转发,同时又必须能同时实现基本的二 层转发和 QinQ业务。  With the rapid development of the network today, network processors are becoming more and more widely used due to their flexible programmability and high processing performance. Network processors need to implement multiple services with limited instruction space and limited resource constraints. Currently, MPLS (Multiprotocol Label Switching) VPN services have been widely applied to the existing network. MPLS-based L2 VPN (Layer 2 VPN) has VPLS (Virual Private LAN Service) and VPWS (Virtual Private Wire Service). VPLS can provide multi-point to multi-point VPN technology. VPWS provides point-to-point Layer 2 VPN technology. Due to its different technologies, it is reflected in the forwarding process. At the same time, L2 VPN access modes are various, such as port-based access, port-based and VLAN-based access, port-based, and two-layer VLAN (Virtual Local Area Network) access. The network processor needs to implement multiple access and forwarding of L2VPN in a limited instruction space, and must implement basic Layer 2 forwarding and QinQ services at the same time.
在以往的实现过程中,往往将 L2 VPN技术和普通二层转发以及 QinQ实 现分别进行处理, 需要针对不同的业务设计不同的表项, 同时设计不同的转 发处理流程, 不但极大的占用资源, 而且由于区分业务进行处理, 浪费指令 空间, 极大的影响网络处理器的性能, 对控制层面来说也增加了负担。 同时 由于不同业务不同处理, 造成需要业务扩展时非常困难, 严重影响了网络处 理器功能实现的可扩展性和兼容性。  In the previous implementation process, the L2 VPN technology and the common Layer 2 forwarding and the QinQ implementation are processed separately. Different entries need to be designed for different services. At the same time, different forwarding processing flows are designed, which not only greatly consumes resources. Moreover, because the service is differentiated and processed, the instruction space is wasted, which greatly affects the performance of the network processor, and also imposes a burden on the control plane. At the same time, because different services are handled differently, it is very difficult to require service expansion, which seriously affects the scalability and compatibility of network processor function implementation.
发明内容 本发明的目的是提供一种实现多业务转发的方法和网络处理器, 通过将 普通二层业务、 QinQ业务、 L2 VPN业务综合进行抽象, 将上述三种业务的 转发表抽象综合一体化, 将上述三种业务的转发流程设计成一个流程, 极大 的节省了网络处理器指令空间和表项资源, 减轻了控制层面负担, 并且提高 了可扩展性和兼容性。 Summary of the invention The object of the present invention is to provide a method for implementing multi-service forwarding and a network processor, which abstracts and integrates the forwarding tables of the above three services by abstracting the common Layer 2 services, QinQ services, and L2 VPN services. The forwarding process of the above three services is designed as a process, which greatly saves the network processor instruction space and table item resources, reduces the burden on the control layer, and improves scalability and compatibility.
为了解决上述技术问题, 本发明提供了一种实现多业务转发的方法, 包 括:  In order to solve the above technical problem, the present invention provides a method for implementing multi-service forwarding, including:
接收到报文后, 根据业务配置解析出报文携带的虚拟局域网 (VLAN ) 信息,  After receiving the packet, the virtual local area network (VLAN) information carried in the packet is parsed according to the service configuration.
根据报文的接入端口信息和所述 VLAN信息查找转发标识;  Finding a forwarding identifier according to the access port information of the packet and the VLAN information;
根据报文携带的目的 MAC地址信息和所述转发标识,在 MAC地址表中 查找目的端口的信息; 以及  And searching for the destination port information in the MAC address table according to the destination MAC address information carried in the packet and the forwarding identifier;
根据查找结果将报文发送给查找到的目的端口或所述转发标识对应的端 口。 优选地, 根据报文的接入端口信息和所述 VLAN信息查找转发标识的步 骤包括:  The packet is sent to the discovered destination port or the port corresponding to the forwarding identifier according to the search result. Preferably, the step of searching for the forwarding identifier according to the access port information of the packet and the VLAN information includes:
若根据业务配置解析出所述报文携带二层 VLAN信息, 则根据特定的哈 希算法将所述接入端口信息和二层 VLAN信息计算为一哈希值; 以及  If the packet carries Layer 2 VLAN information according to the service configuration, the access port information and the Layer 2 VLAN information are calculated as a hash value according to a specific hash algorithm;
根据所述哈希值在预先配置的第一映射表中查找所述转发标识。  And searching, according to the hash value, the forwarding identifier in a pre-configured first mapping table.
优选地, 根据艮文的接入端口信息和所述 VLAN信息查找转发标识的步 骤还包括:  Preferably, the step of searching for the forwarding identifier according to the access port information and the VLAN information of the text further includes:
若根据所述哈希值在预先配置的第一映射表中未查找到转发标识, 则根 据所述接入端口信息和外层 VLAN信息在预先配置的第二映射表中查找所述 转发标识。  If the forwarding identifier is not found in the pre-configured first mapping table according to the hash value, the forwarding identifier is searched in the pre-configured second mapping table according to the access port information and the outer VLAN information.
优选地, 根据报文的接入端口信息和所述 VLAN信息查找转发标识的步 骤包括:  Preferably, the step of searching for the forwarding identifier according to the access port information of the packet and the VLAN information includes:
若根据业务配置解析出所述报文携带一层 VLAN信息或不带 VLAN信 息, 则根据所述接入端口信息和所述一层 VLAN信息、 或者根据所述接入端 口信息和所述接入端口的缺省 VLAN信息在预先配置的第二映射表中查找转 发标识。 If the packet carries a layer of VLAN information or no VLAN information according to the service configuration, according to the access port information and the layer of VLAN information, or according to the access end The port information and the default VLAN information of the access port are used to look up the forwarding identifier in the pre-configured second mapping table.
优选地, 上述方法还包括:  Preferably, the above method further includes:
在所述 MAC地址表中查找与所述报文携带的源 MAC地址信息和所述转 发标识对应的信息, 若未查找到与所述 文携带的源 MAC地址信息和所述 转发标识对应的信息, 或者查找到与所述 文携带的源 MAC地址信息和所 述转发标识对应的信息, 但查找到的端口信息或者虚端口信息与报文的接入 端口信息或虚端口信息不同, 则进行 MAC地址学习, 将源 MAC地址信息、 所述转发标识和所述接入端信息或者虚端口信息填进所述 MAC地址表。  And searching, in the MAC address table, the information corresponding to the source MAC address information and the forwarding identifier carried in the packet, if the information corresponding to the source MAC address information and the forwarding identifier carried in the document is not found. Or, the information corresponding to the source MAC address information and the forwarding identifier carried in the document is found, but the discovered port information or the virtual port information is different from the access port information or the virtual port information of the packet, and then the MAC is performed. Address learning, filling source MAC address information, the forwarding identifier, and the access terminal information or virtual port information into the MAC address table.
为了解决上述技术问题, 本发明还提供了一种网络处理器, 包括: 配置模块, 其设置成: 在接收到用户输入的业务配置信息后, 将所述业 务配置信息中的端口信息和 VLAN信息映射为转发标识, 并建立映射表; 解析模块, 其设置成: 在接收到报文后, 根据所述配置模块的所述业务 配置信息解析出所述报文携带的 VLAN信息,并将所解析出的 VLAN信息输 出给查找模块;  In order to solve the above technical problem, the present invention further provides a network processor, comprising: a configuration module, configured to: after receiving the service configuration information input by the user, the port information and the VLAN information in the service configuration information Mapping to a forwarding identifier, and establishing a mapping table; the parsing module is configured to: after receiving the packet, parse the VLAN information carried by the packet according to the service configuration information of the configuration module, and parse the The output VLAN information is output to the search module.
查找模块, 其设置成: 根据接收到的 VLAN信息和所述报文的接入端口 信息在所述映射表中查找转发标识, 然后根据查找到的转发标识和所述报文 携带的目的 MAC信息在 MAC地址表中查找目的端口的信息,将查找结果消 息输出给转发模块; 以及  a locating module, configured to: search for a forwarding identifier in the mapping table according to the received VLAN information and the access port information of the packet, and then, according to the found forwarding identifier and the destination MAC information carried by the packet Finding the information of the destination port in the MAC address table, and outputting the search result message to the forwarding module;
转发模块, 其设置成根据接收到的查找结果消息将报文发送给查找到的 目的端口或转发标识对应的端口。  And a forwarding module, configured to send the packet to the discovered destination port or the port corresponding to the forwarding identifier according to the received search result message.
优选地, 所述配置模块是设置成通过如下方式建立映射表: 若所述业务 配置信息中的 VLAN信息为二层 VLAN信息,则根据哈希算法将所述端口信 息和二层 VLAN信息计算为第一哈希值,为所述第一哈希值配置一转发标识, 建立第一映射表;若所述业务配置信息中的 VLAN信息为一层 VLAN信息或 无 VLAN信息, 则将所述端口信息和所述一层 VLAN信息、 或将所述端口信 息和缺省 VLAN信息映射为一转发标识, 建立第二映射表。  Preferably, the configuration module is configured to establish a mapping table by: if the VLAN information in the service configuration information is Layer 2 VLAN information, calculating the port information and the Layer 2 VLAN information according to a hash algorithm. a first hash value, configured with a forwarding identifier for the first hash value, to establish a first mapping table; if the VLAN information in the service configuration information is a layer of VLAN information or no VLAN information, the port is The information and the layer of VLAN information, or the port information and the default VLAN information are mapped into a forwarding identifier, and a second mapping table is established.
优选地, 所述解析模块是设置成通过如下方式将解析出的 VLAN信息输 出给查找模块: 若解析出所述报文携带的 VLAN信息为二层 VLAN信息, 则 根据所述哈希算法将所述接入端口信息和所述报文携带的二层 VLAN信息计 算为第二哈希值, 将所述第二哈希值输出给所述查找模块; 所述查找模块是设置成根据接收到的所述第二哈希值在所述第一映射表 中查找转发标识。 Preferably, the parsing module is configured to input the parsed VLAN information by: The query module is configured to: if the VLAN information carried in the packet is the Layer 2 VLAN information, calculate the access port information and the Layer 2 VLAN information carried in the packet according to the hash algorithm. a second hash value, the second hash value is output to the lookup module; the lookup module is configured to look up a forwarding identifier in the first mapping table according to the received second hash value.
优选地, 所述查找模块还设置成通过如下方式查找转发标识: 若根据所 述第二哈希值在所述第一映射表中未查找到转发标识, 则根据所述接入端口 信息和外层 VLAN信息在所述第二映射表中查找转发标识。  Preferably, the searching module is further configured to: look up the forwarding identifier by: if the forwarding identifier is not found in the first mapping table according to the second hash value, according to the access port information and The layer VLAN information looks up the forwarding identifier in the second mapping table.
优选地, 所述解析模块还设置成通过如下方式将解析出的 VLAN信息输 出给查找模块:若解析出所述报文携带的 VLAN信息为一层 VLAN信息或不 带 VLAN信息, 则将所述报文携带的一层 VLAN信息或将接入端口的缺省 VLAN信息输出给所述查找模块;  Preferably, the parsing module is further configured to: output the parsed VLAN information to the searching module by: if the VLAN information carried in the packet is a layer of VLAN information or no VLAN information, Outputting a layer of VLAN information carried in the packet or outputting the default VLAN information of the access port to the searching module;
所述查找模块还设置成通过如下方式查找转发标识: 根据所述接入端口 信息和所述报文携带的一层 VLAN信息、 或者根据所述接入端口的信息和所 述接入端口的缺省 VLAN信息在所述第二映射表中查找转发标识。  The locating module is further configured to: search for the forwarding identifier according to the access port information and the layer of VLAN information carried by the packet, or according to the information about the access port and the lack of the access port. The provincial VLAN information looks up the forwarding identifier in the second mapping table.
优选地, 上述网络处理器还包括学习模块,  Preferably, the network processor further includes a learning module,
所述查找模块还设置成: 在所述 MAC地址表中查找与所述报文携带的 源 MAC地址信息和所查找到的转发标识对应的信息, 若未查找到与所述才艮 文携带的源 MAC地址信息和所查找到的转发标识对应的信息, 或者查找到 与所述报文携带的源 MAC地址信息和所查找到的转发标识对应的信息, 但 查找到的端口信息或者虚端口信息与报文的接入端口信息或虚端口信息不 同, 则向所述学习模块输出一消息;  The locating module is further configured to: search, in the MAC address table, information corresponding to the source MAC address information carried by the packet and the forwarded identifier that is found, if the information is not found The source MAC address information and the information corresponding to the found forwarding identifier, or the information corresponding to the source MAC address information and the found forwarding identifier carried in the packet, but the discovered port information or virtual port information. Different from the access port information or the virtual port information of the packet, outputting a message to the learning module;
学习模块设置成接收到所述查找模块输出的消息后, 进行 MAC地址学 习, 将所述 文携带的源 MAC地址信息、 所述查找模块查找到的转发标识 和所述接入端口信息或者虚端口信息学习到所述 MAC地址表。  The learning module is configured to: after receiving the message output by the searching module, perform MAC address learning, the source MAC address information carried in the document, the forwarding identifier found by the searching module, and the access port information or virtual port The information learns the MAC address table.
综上, 本发明提供的实现多业务转发的方法和网络处理器, 通过将二层 业务转发的关键性因素统一映射成内部的转发标识, 对普通二层业务、 QinQ 业务、 L2 VPN业务设计相同的表项, 同时设计相同的转发处理流程, 节约了 资源, 极大的优化了网络处理器的可扩展性和兼容性等的性能。 附图概述 In summary, the method and the network processor for implementing the multi-service forwarding provided by the present invention uniformly map the key factors of the Layer 2 service forwarding to the internal forwarding identifier, and the ordinary Layer 2 service, QinQ. The service and L2 VPN services are designed with the same entries, and the same forwarding processing flow is designed at the same time, which saves resources and greatly optimizes the scalability and compatibility of the network processor. BRIEF abstract
图 1为本发明实施例的网络处理器的示意图;  1 is a schematic diagram of a network processor according to an embodiment of the present invention;
图 2是根据本发明实施例的多业务报文转发的方法的流程图。 本发明的较佳实施方式  2 is a flow chart of a method for forwarding multi-service messages according to an embodiment of the present invention. Preferred embodiment of the invention
普通二层业务的 VLAN、 QinQ业务中的单层 VLAN和双层 VLAN以及 L2 VPN业务中的 VPN ID分别是上述三种业务转发的关键性因素, 本发明的 核心思想是将上述关键因素统一抽象映射成内部转发标识 FID, 在转发流程 上, 对普通二层业务、 QinQ业务和 VPLS业务的转发统一用 文携带的目的 MAC ( DMAC )地址和 FID来查找转发目的地址, VPWS直接根据 FID进行 转发。  The core of the Layer 2 service, the single-layer VLAN and the double-layer VLAN in the QinQ service, and the VPN ID in the L2 VPN service are the key factors for the above three types of service forwarding. The core idea of the present invention is to abstract the above key factors. It is mapped to the internal forwarding identifier FID. In the forwarding process, the forwarding destination address is searched for the destination MAC address (DMAC) address and FID carried in the unified Layer 2 service, QinQ service, and VPLS service. The VPWS directly forwards the packet according to the FID. .
图 1为本发明实施例的网络处理器的示意图, 如图所示, 本实施例的网 络处理器包括: 配置模块、 解析模块、 查找模块、 学习模块和转发模块。  1 is a schematic diagram of a network processor according to an embodiment of the present invention. As shown in the figure, the network processor of this embodiment includes: a configuration module, a parsing module, a searching module, a learning module, and a forwarding module.
配置模块设置成: 接收用户输入的业务配置信息后, 将用户配置的各种 业务的端口信息和 VLAN信息映射为转发标识 FID。  The configuration module is configured to: after receiving the service configuration information input by the user, mapping port information and VLAN information of various services configured by the user into a forwarding identifier FID.
具体地, 对于通过端口和一层 VLAN映射 FID可以实现——映射; 对于 通过端口和两层 VLAN映射 FID, 由于直接用端口和两层 VLAN——映射 FID, 会占用较大的表项资源, 可以先通过某种哈希(HASH )算法将端口和 两层 VLAN计算成一 HASH值, 再将 HASH值和 FID——映射。  Specifically, the FID can be implemented by mapping the FID through the port and the layer of the VLAN. For the FID through the port and the two-layer VLAN, the FID is directly used by the port and the two-layer VLAN. The port and the two-layer VLAN can be first calculated into a HASH value by a hash (HASH) algorithm, and then the HASH value and the FID are mapped.
对于普通二层业务, 同一个 VLAN的端口可以申请同一个 FID, 如表 1 所示, VLAN Y1中有端口 XI和 X2, 表中的端口 XI、 X2和 VLAN Y1申请 的 FID相同, 都为 Nl。  For common Layer 2 services, ports of the same VLAN can apply for the same FID. As shown in Table 1, VLAN Y1 has ports XI and X2. Ports XI, X2, and VLAN Y1 in the table apply for the same FID, all of which are Nl. .
对于 QinQ 业务, 用户配置的信息有: 用户侧端口、 网络侧端口、 内层 VLAN和外层 VLAN, 并且将网络侧端口配置成可解析两层 VLAN。 具体的 映射为: 对于用户侧, 根据端口和内层 VLAN申请一个 FID, 对于网络侧根 据端口和两层 VLAN申请 FID, 这两个 FID数值一样。 假设配置用户侧端口 为 X3 , 网络侧端口为 X4 , 内层 VLAN为 Y2 , 外层 VLAN为 Y3 , 则如表 1 所示, 端口 X3、 VLAN Y2的 FID为 N2 , 网络侧端口 X4、 VLAN Y2、 VLAN Y3通过 HASH算法算出 HASH值 Ml , 如表 2 , 将 Ml和 N2填写入表中。 For the QinQ service, the user-configured information includes: user-side port, network-side port, inner-layer VLAN, and outer VLAN, and the network-side port is configured to resolve two-layer VLAN. The specific mapping is: For the user side, apply for an FID based on the port and inner VLAN, for the network side root The FID is applied according to the port and the two-layer VLAN. The two FID values are the same. Assume that the user-side port is X3, the network-side port is X4, the inner-layer VLAN is Y2, and the outer VLAN is Y3. As shown in Table 1, the FID of port X3 and VLAN Y2 is N2, and the network-side port X4 and VLAN Y2. The VLAN Y3 calculates the HASH value M1 through the HASH algorithm. As shown in Table 2, Ml and N2 are filled into the table.
对于 L2 VPN业务, 如果有端口和两层 VLAN接入, 将该端口配置成可 以解析两层 VLAN, 对于 VPLS , 同一个 VPN内的接入配置相同的 FID, 如 表 1所示 , 假设端口 X5和 VLAN Y5接入 VPN 1 , 端口 X6和 VLAN Y6也 接入 VPN 1 , 则同一个 VPN接入申请的 FID一样为 N3。对于 VPWS , VPWS 的接入也有三种, 通过端口、 端口和一层 VLAN或端口和两层 VLAN。 如果 配置端口 χ7和 VLAN Y7接入, 则申请 FID N4 , 同时表中 VPWS位置为 1 , 表示是 VPWS。如果配置端口 X8、 VLAN Y8和 VLAN Y9接入 VPWS , 则根 据端口 X8、 VLAN Y8和 VLAN Y9计算出 HASH值 M3 , 申请 FID N6写入 表中。  For the L2 VPN service, if there is a port and two layers of VLAN access, configure the port to be able to resolve the two-layer VLAN. For VPLS, the same FID is configured in the same VPN, as shown in Table 1, assuming port X5. And VLAN Y5 accesses VPN 1, port X6 and VLAN Y6 also access VPN 1, and the FID of the same VPN access request is N3. For VPWS, there are also three types of VPWS access, through ports, ports, and a layer of VLANs or ports and two layers of VLANs. If port χ7 and VLAN Y7 are configured to access, apply FID N4 and the VPWS position in the table is 1 to indicate VPWS. If you configure port X8, VLAN Y8, and VLAN Y9 to access VPWS, calculate HASH value M3 based on port X8, VLAN Y8, and VLAN Y9, and apply FID N6 to the table.
表 1  Table 1
Figure imgf000008_0001
Figure imgf000008_0001
表 2  Table 2
Figure imgf000008_0002
Figure imgf000008_0002
解析模块设置成: 当接收到报文时, 根据所述配置模块的所述业务配置 信息解析出所述报文携带的 VLAN信息,将所述 VLAN信息输出给查找模块。 一般报文的格式为: 目的 MAC ( DMAC ) +源 MAC ( SMAC ) + VLAN tag (标志) +ETYPE +PAYLOAD, 其中, PAYLOAD表示才艮文的内容, ETYPE 是以太类型。 The parsing module is configured to: when receiving the packet, according to the service configuration of the configuration module The information is parsed out of the VLAN information carried in the packet, and the VLAN information is output to the searching module. The format of the general message is: destination MAC (DMAC) + source MAC (SMAC) + VLAN tag (flag) + ETYPE + PAYLOAD, where PAYLOAD indicates the content of the message, ETYPE is the Ethernet type.
进一步地, 解析模块可以从报文格式中的 VLAN标志解析出报文携带的 Further, the parsing module can parse the packet carried by the VLAN tag in the packet format.
VLAN信息, 具体地, 对于普通二层业务、 QinQ业务和 L2 VPN业务的报文 解析出来的 VLAN信息可能携带二层 VLAN信息,也可能携带一层 VLAN信 息, 或者不携带 VLAN信息。 The VLAN information, specifically, the VLAN information parsed by the packets of the ordinary Layer 2 service, the QinQ service, and the L2 VPN service may carry Layer 2 VLAN information, or may carry a layer of VLAN information or do not carry VLAN information.
查找模块设置成: 根据报文携带的 VLAN信息和报文接入的端口信息在 预先配置的映射表中查找转发标识 FID, 然后根据所述 FID和所述报文携带 的目的 MAC信息在 MAC地址表中查找目的端口的信息,将查找结果消息输 出给转发模块。  The locating module is configured to: look up the forwarding identifier FID in the pre-configured mapping table according to the VLAN information carried in the packet and the port information of the packet, and then use the FID and the destination MAC address carried in the packet in the MAC address. The information in the table is searched for the destination port, and the search result message is output to the forwarding module.
具体地,对于携带两层 VLAN信息的报文,通过釆用与配置模块配置 FID 时相同的 HASH算法, 将报文携带的端口信息和两层 VLAN计算成一 HASH 值, 再通过计算得到的 HASH值在表 2中查找 FID, 如果没有查找到相应的 FID, 就釆用端口和外层 VLAN再查映射表, 如表 1 ; 对于携带一层 VLAN 的报文, 直接用端口信息和 VLAN信息查映射, 如表 1 ; 对于没有带 VLAN 的报文, 用端口信息和端口缺省 VLAN信息查映射表, 如表 1 , 如果没有查 找到相应的 FID, 则表示没有配置相应的 FID, 将报文丟弃。  Specifically, for the packet carrying the two-layer VLAN information, the port information carried in the packet and the two-layer VLAN are calculated into a HASH value by using the same HASH algorithm as that configured by the configuration module, and the calculated HASH value is obtained. Look for the FID in Table 2. If the corresponding FID is not found, use the port and the outer VLAN to check the mapping table, as shown in Table 1. For packets carrying a layer of VLAN, directly use the port information and VLAN information to check the mapping. For the packets without VLANs, use the port information and the default VLAN information of the port to check the mapping table. For example, if the corresponding FID is not found, the corresponding FID is not configured. abandoned.
具体地, 查找模块根据查找到的 FID和报文的目的 MAC信息查找多业 务 MAC地址表 (如表 3所示)。 如果在表 3中能够查找到与目的 MAC和 FID 的相应信息, 则可以查找到与目的 MAC和 FID对应的目的端口信息, 然后 将查找到目的端口的结果消息输出给转发模块;如果在表 3中未查找到 MAC 和 FID的相应信息, 则将未查找到目的端口的结果消息输出给转发模块。  Specifically, the lookup module searches the multi-service MAC address table according to the found FID and the destination MAC information of the packet (as shown in Table 3). If the corresponding information of the destination MAC and the FID can be found in Table 3, the destination port information corresponding to the destination MAC and the FID can be found, and then the result message of the destination port is output to the forwarding module; If the corresponding information of the MAC and the FID is not found, the result message that the destination port is not found is output to the forwarding module.
转发模块设置成接收到查找结果消息后,将报文发送给 FID对应的端口。 具体地, 若转发模块接收到查找到目的端口的结果消息, 则将报文发送 到该查找到的目的端口。  The forwarding module is configured to send the message to the port corresponding to the FID after receiving the search result message. Specifically, if the forwarding module receives the result message of finding the destination port, the forwarding module sends the message to the found destination port.
如果在转发模块接收到未查找到目的端口的结果消息, 则直接将报文在 FID对应的端口内广播, 如果是普通二层业务, 则该 FID对应的端口就是该 VLAN中的端口, 如果是 L2 VPN业务, 则 FID对应的端口就是该 VPN中的 本地成员和远端成员。 对于 VPWS业务, 则直接根据 FID对应的端口进行转 发。 If the forwarding module receives the result message that the destination port is not found, the packet is directly If the port is the normal Layer 2 service, the port corresponding to the FID is the port in the VLAN. If the L2 VPN service is used, the port corresponding to the FID is the local member and the remote member of the VPN. For the VPWS service, it is directly forwarded according to the port corresponding to the FID.
表 3 MAC地址表
Figure imgf000010_0001
Table 3 MAC address table
Figure imgf000010_0001
进一步地, 本实施例的网络处理器还包括学习模块,  Further, the network processor of this embodiment further includes a learning module,
查找模块还设置成: 在所述 MAC地址表中查找所述报文携带的源 MAC 地址信息和所述 FID的对应信息, 该对应信息指: 与源 MAC地址信息、 FID 和接入端口信息或虚端口信息完全对应的信息, 这样若未查找到与源 MAC 地址信息和 FID对应的信息, 或者查找到与源 MAC地址信息和 FID对应的 信息, 但是查找到的端口信息或者虚端口信息与报文的接入端口信息或虚端 口信息不同, 则向所述学习模块输出一消息;  The locating module is further configured to: search, in the MAC address table, source MAC address information carried by the packet and corresponding information of the FID, where the corresponding information is: and source MAC address information, FID, and access port information or The information corresponding to the virtual port information is completely matched. If the information corresponding to the source MAC address information and the FID is not found, or the information corresponding to the source MAC address information and the FID is found, but the found port information or the virtual port information and the report are found. If the access port information or the virtual port information of the file is different, a message is output to the learning module;
学习模块设置成接收到所述查找模块输出的消息后, 学习 MAC地址, 将 SMAC地址、 FID和接入端口信息或者虚端口信息学习到多业务 MAC地 址表。  The learning module is configured to learn the MAC address, learn the SMAC address, the FID and the access port information or the virtual port information to learn the multi-service MAC address table after receiving the message output by the search module.
下面详细说明基于上述的网络处理器进行多业务报文转发的方法。 The method for performing multi-service message forwarding based on the above network processor is described in detail below.
图 2是根据本发明实施例的多业务报文转发的方法的流程图, 网络处理 器接收用户配置的各种业务, 预先将端口信息和 VLAN信息配置成转发标识 FID, 建立端口信息和 VLAN信息与 FID——映射的映射关系表。 如图所示, 本实施例的多业务 文转发的方法包括下面步骤:  2 is a flowchart of a method for forwarding a multi-service message according to an embodiment of the present invention. The network processor receives various services configured by the user, and configures port information and VLAN information into a forwarding identifier FID in advance, and establishes port information and VLAN information. Mapping table with FID - mapping. As shown in the figure, the method for forwarding a multi-service text in this embodiment includes the following steps:
S110: 网络处理器接收报文;  S110: The network processor receives the packet.
S120: 网络处理器根据业务配置解析出报文携带的 VLAN信息;  S120: The network processor parses the VLAN information carried in the packet according to the service configuration.
S130: 根据报文接入的端口信息和携带的 VLAN信息查找预先配置的转 发标识 FID;  S130: Search for a pre-configured forwarding identifier FID according to the port information and the carried VLAN information.
由于用户配置的普通二层业务、 QinQ业务和 L2 VPN业务的报文可能携 带二层 VLAN标志, 也可能携带一层 VLAN标志, 或者不携带 VLAN标志。 对于携带二层 VLAN标志的情况, 可以通过端口和两层 VLAN映射 FID, 但 由于直接用端口和两层 VLAN——映射 FID, 将会占用较大的表项资源, 所 以在配置时可以先通过某种哈希 (HASH )算法将端口和两层 VLAN计算成 一 HASH值,再将 HASH值和 FID——映射。对于携带一层 VLAN标志的情 况, 可以通过端口和一层 VLAN映射 FID实现——映射。对未携带 VLAN标 志的情况, 可以通过端口和缺省 VLAN来映射 FID以实现——映射。 Packets of the common Layer 2 service, QinQ service, and L2 VPN service may be carried. With a Layer 2 VLAN tag, it may carry a layer of VLAN tags or do not carry VLAN tags. In the case of carrying the Layer 2 VLAN tag, the FID can be mapped through the port and the two-layer VLAN. However, because the port and the two-layer VLAN are directly used, the FID will be used to occupy large entries. Therefore, you can pass the configuration first. A hash (HASH) algorithm calculates the port and the two layers of VLANs into a HASH value, and then maps the HASH value and the FID. For the case of carrying a layer of VLAN tags, you can implement mapping by port and a layer of VLAN mapping FID. For the case where the VLAN tag is not carried, the FID can be mapped through the port and the default VLAN to implement mapping.
因此, 进一步地, 步骤 S131 , 网络处理器在解析报文的过程中, 先判断 报文携带 VLAN信息的情况, 若报文携带两层 VLAN, 则进入步骤 S132, 若 报文没有携带 VLAN或者只带一层 VLAN, 则进入步骤 S133。  Therefore, in step S131, the network processor first determines that the packet carries the VLAN information in the process of parsing the packet. If the packet carries the two-layer VLAN, the process proceeds to step S132, if the packet does not carry the VLAN or only If a layer of VLAN is carried, the process proceeds to step S133.
S132, 利用配置时釆用的 HASH算法, 通过 文携带的端口信息和两层 VLAN信息计算得到 HASH值,根据算出的 HASH值查找预先配置的 HASH 值与 FID的映射表(例如, 表 2 ) , 若查找到 HASH值对应的 FID, 则进入 步骤 S140, 若未查到 HASH值对应的 FID, 则进入步骤 S133。  S132, using the HASH algorithm used in the configuration, calculating the HASH value by using the port information and the two layers of VLAN information carried in the text, and searching for a pre-configured HASH value and FID mapping table according to the calculated HASH value (for example, Table 2). If the FID corresponding to the HASH value is found, the process proceeds to step S140. If the FID corresponding to the HASH value is not found, the process proceeds to step S133.
S133 , 根据端口和外层 VLAN查找 FID映射表(例如, 表 1 ) , 如果报 文没有带 VLAN,就用端口和端口的缺省 VLAN查 FID映射表(例如,表 1 ) , 若查找到对应的 FID, 则进入步骤 S140, 若未查找到就将报文丟弃。  S133. Search for the FID mapping table according to the port and the outer VLAN (for example, Table 1). If the packet does not have a VLAN, use the default VLAN of the port and the port to check the FID mapping table (for example, Table 1). If the FID is not found, the message is discarded.
进一步地, S140, 判断是否是 VPWS接入, 若是, 则进入步骤 S180, 若 不是则进入步骤 S150。  Further, in S140, it is determined whether it is VPWS access, if yes, the process goes to step S180, and if not, the process goes to step S150.
具体地, 在预先配置的映射表中 (例如, 表 1或表 2 )查询标记是否为 Specifically, in the pre-configured mapping table (for example, Table 1 or Table 2), is the query flag
VPWS的项, 例如, 表 1或表 2中标记是否为 VPWS的项置为 "1" , 说明 该报文是 VPWS接入。 For VPWS entries, for example, the entry in Table 1 or Table 2 marked as VPWS is set to "1", indicating that the message is VPWS access.
S150,根据报文中携带的源 MAC和查到的 FID查找多业务 MAC表, 若 未查找到与源 MAC地址信息和 FID对应的信息,或者查找到源 MAC地址信 息和 FID对应的信息, 但是查找到的端口信息或者虚端口信息与报文的接入 端口信息或虚端口信息不同信息, 则进入步骤 S160, 否则进入步骤 S170。  S150. Search for the multi-service MAC table according to the source MAC and the FID that are carried in the packet. If the information corresponding to the source MAC address information and the FID is not found, or the source MAC address information and the information corresponding to the FID are found, If the found port information or the virtual port information is different from the access port information or the virtual port information of the packet, the process proceeds to step S160, otherwise, the process proceeds to step S170.
S160 ,将 SMAC地址、 FID和接入端口或虚端口信息学习到多业务 MAC 地址表。 S170,根据报文中携带的 DMAC和查到的 FID查找多业务 MAC表, 如 果在多业务 MAC表中查到目的端口信息, 则将报文转发至查找到的目的端 口, 否则进入步骤 S180。 S160. The SMAC address, the FID, and the access port or the virtual port information are learned into the multi-service MAC address table. S170: Search for the multi-service MAC table according to the DMAC carried in the packet and the FID found. If the destination port information is found in the multi-service MAC table, the packet is forwarded to the found destination port, otherwise the process proceeds to step S180.
S180 , 将报文在 FID对应的端口上广播, 如果报文是普通二层业务和 QinQ业务, 则在多业务 MAC表中查找到的 FID对应的广播端口就是普通二 层业务和 QinQ业务中相应 VLAN中的端口; 如果 4艮文是 VPWS业务, 则多 业务 MAC表中查找到的该 FID中只有一个目的端口, 就直接通过该目的端 口转发; 如果是 VPLS业务, 该多业务 MAC表中查找到的 FID对应的广播 端口就是该 VPN的本地成员和远端成员。  S180: The packet is broadcasted on the port corresponding to the FID. If the packet is a common Layer 2 service and a QinQ service, the broadcast port corresponding to the FID found in the multi-service MAC address is corresponding to the common Layer 2 service and the QinQ service. If the port is a VPWS service, only one destination port in the FID found in the multi-service MAC table is forwarded directly through the destination port; if it is a VPLS service, the multi-service MAC table is searched. The broadcast port corresponding to the FID is the local member and remote member of the VPN.
以上所述仅为本发明的实施例而已, 并不用于限制本发明, 对于本领域 的技术人员来说, 本发明可以有各种更改和变化。 凡在本发明的精神和原则 之内, 所作的任何修改、 等同替换、 改进等, 均应包含在本发明的权利要求 范围之内。 The above is only the embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes can be made to the present invention. All modifications, equivalents, improvements, etc., made within the spirit and scope of the invention are intended to be included within the scope of the appended claims.
工业实用性 Industrial applicability
与现有技术相比, 本发明通过将二层业务转发的关键性因素统一映射成 内部的转发标识, 对普通二层业务、 QinQ业务、 L2 VPN业务设计相同的表 项, 同时设计相同的转发处理流程, 节约了资源, 极大的优化了网络处理器 的可扩展性和兼容性等的性能。  Compared with the prior art, the present invention uniformly maps the key factors of the Layer 2 service forwarding to the internal forwarding identifier, and designs the same entries for the common Layer 2 service, the QinQ service, and the L2 VPN service, and designs the same forwarding at the same time. The processing flow saves resources and greatly optimizes the performance of the network processor's scalability and compatibility.

Claims

权 利 要 求 书 Claim
1、 一种实现多业务转发的方法, 包括: 1. A method for implementing multi-service forwarding, comprising:
接收到报文后, 根据业务配置解析出报文携带的虚拟局域网 VLAN信息; 根据报文的接入端口信息和所述 VLAN信息查找转发标识;  After receiving the packet, parsing the VLAN information of the virtual local area network carried in the packet according to the service configuration; and searching for the forwarding identifier according to the access port information of the packet and the VLAN information;
根据报文携带的目的媒体访问控制 MAC地址信息和所述转发标识, 在 According to the destination media access control MAC address information carried by the packet and the forwarding identifier,
MAC地址表中查找目的端口的信息; 以及 Find the information of the destination port in the MAC address table;
根据查找结果将报文发送给查找到的目的端口或所述转发标识对应的端 口。  The packet is sent to the discovered destination port or the port corresponding to the forwarding identifier according to the search result.
2、 如权利要求 1 所述的方法, 其中, 根据报文的接入端口信息和所述 VLAN信息查找转发标识的步骤包括: 2. The method according to claim 1, wherein the step of searching for the forwarding identifier according to the access port information of the packet and the VLAN information comprises:
若根据业务配置解析出所述报文携带二层 VLAN信息, 则根据特定的哈 希算法将所述接入端口信息和所述二层 VLAN信息计算为一哈希值; 以及 根据所述哈希值在预先配置的第一映射表中查找所述转发标识。  If the packet carries Layer 2 VLAN information according to the service configuration, the access port information and the Layer 2 VLAN information are calculated as a hash value according to a specific hash algorithm; and according to the hash. The value looks up the forwarding identifier in a pre-configured first mapping table.
3、 如权利要求 2 所述的方法, 其中, 根据报文的接入端口信息和所述 VLAN信息查找转发标识的步骤还包括:  The method of claim 2, wherein the step of searching for the forwarding identifier according to the access port information of the packet and the VLAN information further includes:
若根据所述哈希值在所述预先配置的第一映射表中未查找到所述转发标 识, 则根据所述接入端口信息和外层 VLAN信息在预先配置的第二映射表中 查找所述转发标识。  If the forwarding identifier is not found in the pre-configured first mapping table according to the hash value, searching for the location in the pre-configured second mapping table according to the access port information and the outer VLAN information. Said forwarding identifier.
4、 如权利要求 1 所述的方法, 其中, 根据报文的接入端口信息和所述 VLAN信息查找转发标识的步骤包括:  The method of claim 1, wherein the step of searching for the forwarding identifier according to the access port information of the packet and the VLAN information comprises:
若根据业务配置解析出所述报文携带一层 VLAN信息或不带 VLAN信 息, 则根据所述接入端口信息和所述一层 VLAN信息、 或者根据所述接入端 口信息和所述接入端口的缺省 VLAN信息在预先配置的第二映射表中查找所 述转发标识。  If the packet carries a layer of VLAN information or no VLAN information according to the service configuration, according to the access port information and the layer of VLAN information, or according to the access port information and the access The default VLAN information of the port is searched for in the pre-configured second mapping table.
5、 如权利要求 1-4任一项所述的方法, 还包括:  5. The method of any of claims 1-4, further comprising:
在所述 MAC地址表中查找与所述报文携带的源 MAC地址信息和所述转 发标识对应的信息, 若未查找到与所述 文携带的源 MAC地址信息和所述 转发标识对应的信息, 或者查找到与所述 文携带的源 MAC地址信息和所 述转发标识对应的信息, 但查找到的端口信息或者虚端口信息与报文的接入 端口信息或虚端口信息不同, 则进行 MAC地址学习, 将源 MAC地址信息、 所述转发标识和所述接入端口信息或者虚端口信息填进所述 MAC地址表。 Searching, in the MAC address table, source MAC address information and the forwarding carried in the packet And the information corresponding to the source MAC address information and the forwarding identifier carried in the document, or the information corresponding to the source MAC address information and the forwarding identifier carried in the document is not found. If the discovered port information or the virtual port information is different from the access port information or the virtual port information of the packet, the MAC address learning is performed, and the source MAC address information, the forwarding identifier, and the access port information or virtual The port information is filled in the MAC address table.
6、 一种网络处理器, 包括: 6. A network processor, comprising:
配置模块, 其设置成: 在接收到用户输入的业务配置信息后, 将所述业 务配置信息中的端口信息和虚拟局域网 VLAN信息映射为转发标识, 并建立 映射表;  a configuration module, configured to: after receiving the service configuration information input by the user, mapping the port information and the virtual local area network VLAN information in the service configuration information to a forwarding identifier, and establishing a mapping table;
解析模块, 其设置成: 在接收到报文后, 根据所述配置模块的所述业务 配置信息解析出所述报文携带的 VLAN信息,并将所解析出的 VLAN信息输 出给查找模块;  The parsing module is configured to: after receiving the packet, parse the VLAN information carried by the packet according to the service configuration information of the configuration module, and output the parsed VLAN information to the searching module;
查找模块, 其设置成: 根据接收到的 VLAN信息和所述报文的接入端口 信息在所述映射表中查找转发标识, 然后根据查找到的转发标识和所述报文 携带的目的媒体访问控制 MAC信息在 MAC地址表中查找目的端口的信息, 将查找结果消息输出给转发模块; 以及  a locating module, configured to: search for a forwarding identifier in the mapping table according to the received VLAN information and the access port information of the packet, and then access the destination media according to the found forwarding identifier and the packet Controlling the MAC information to find the information of the destination port in the MAC address table, and outputting the search result message to the forwarding module;
转发模块, 其设置成根据接收到的查找结果消息将报文发送给查找到的 目的端口或查找到的转发标识对应的端口。  And a forwarding module, configured to send the packet to the searched destination port or the port corresponding to the found forwarding identifier according to the received search result message.
7、 如权利要求 6所述的网络处理器, 其中,  7. The network processor according to claim 6, wherein
所述配置模块是设置成通过如下方式建立映射表: 若所述业务配置信息 中的 VLAN信息为二层 VLAN信息,则根据哈希算法将所述端口信息和二层 VLAN信息计算为第一哈希值, 为所述第一哈希值配置一转发标识, 建立第 一映射表; 若所述业务配置信息中的 VLAN信息为一层 VLAN信息或无 VLAN信息, 则将所述端口信息和所述一层 VLAN信息、 或将所述端口信息 和缺省 VLAN信息映射为一转发标识, 建立第二映射表。  The configuration module is configured to establish a mapping table by: if the VLAN information in the service configuration information is Layer 2 VLAN information, calculating the port information and the Layer 2 VLAN information as the first hash according to a hash algorithm. a value, a forwarding identifier is configured for the first hash value, and a first mapping table is established; if the VLAN information in the service configuration information is a layer of VLAN information or no VLAN information, the port information and the The layer 1 VLAN information is mapped, or the port information and the default VLAN information are mapped to a forwarding identifier, and a second mapping table is established.
8、 如权利要求 7所述的网络处理器, 其中,  8. The network processor according to claim 7, wherein
所述解析模块是设置成通过如下方式将解析出的 VLAN信息输出给查找 模块: 若解析出所述报文携带的 VLAN信息为二层 VLAN信息, 则根据所述 哈希算法将所述接入端口信息和所述报文携带的二层 VLAN信息计算为第二 哈希值, 将所述第二哈希值输出给所述查找模块; The parsing module is configured to output the parsed VLAN information to the search module by: if the VLAN information carried in the packet is parsed into Layer 2 VLAN information, according to the The hash algorithm calculates the access port information and the Layer 2 VLAN information carried in the packet as a second hash value, and outputs the second hash value to the search module.
所述查找模块是设置成根据接收到的所述第二哈希值在所述第一映射表 中查找转发标识。  The lookup module is configured to look up a forwarding identifier in the first mapping table according to the received second hash value.
9、 如权利要求 8所述的网络处理器, 其中,  9. The network processor according to claim 8, wherein
所述查找模块还设置成通过如下方式查找转发标识: 若根据所述第二哈 希值在所述第一映射表中未查找到转发标识, 则根据所述接入端口信息和外 层 VLAN信息在所述第二映射表中查找转发标识。  The searching module is further configured to: find the forwarding identifier by: if the forwarding identifier is not found in the first mapping table according to the second hash value, according to the access port information and the outer VLAN information Looking up the forwarding identifier in the second mapping table.
10、 如权利要求 8所述的网络处理器, 其中, 10. The network processor according to claim 8, wherein
所述解析模块还设置成通过如下方式将解析出的 VLAN信息输出给查找 模块: 若解析出所述报文携带的 VLAN信息为一层 VLAN信息或不带 VLAN 信息,则将所述报文携带的一层 VLAN信息或将接入端口的缺省 VLAN信息 输出给所述查找模块;  The parsing module is further configured to: output the parsed VLAN information to the search module by: if the VLAN information carried in the packet is a layer of VLAN information or no VLAN information, the packet is carried One layer of VLAN information or output default VLAN information of the access port to the lookup module;
所述查找模块还设置成通过如下方式查找转发标识: 根据所述接入端口 信息和所述一层 VLAN信息、 或者根据所述接入端口信息和所述接入端口的 缺省 VLAN信息在所述第二映射表中查找转发标识。  The searching module is further configured to: search for a forwarding identifier according to the access port information and the layer of VLAN information, or according to the access port information and default VLAN information of the access port; Find the forwarding identifier in the second mapping table.
11、 如权利要求 6-10任一项所述的网络处理器, 还包括学习模块, 所述查找模块还设置成: 在所述 MAC地址表中查找与所述报文携带的 源 MAC地址信息和所查找到的转发标识对应的信息, 若未查找到与所述才艮 文携带的源 MAC地址信息和所查找到的转发标识对应的信息, 或者查找到 与所述报文携带的源 MAC地址信息和所查找到的转发标识对应的信息, 但 查找到的端口信息或者虚端口信息与报文的接入端口信息或虚端口信息不 同, 则向所述学习模块输出一消息; The network processor according to any one of claims 6 to 10, further comprising a learning module, wherein the searching module is further configured to: search for the source MAC address information carried in the packet in the MAC address table. And the information corresponding to the forwarded identifier that is found, if the information corresponding to the source MAC address information and the forwarded identifier that is carried in the packet is not found, or the source MAC carried in the packet is found. The address information and the information corresponding to the forwarded identifier are found, but the discovered port information or the virtual port information is different from the access port information or the virtual port information of the packet, and a message is output to the learning module.
学习模块设置成接收到所述查找模块输出的消息后, 进行 MAC地址学 习, 将所述 文携带的源 MAC地址信息、 所述查找模块查找到的转发标识 和所述接入端口信息或虚端口信息学习到所述 MAC地址表。  The learning module is configured to: after receiving the message output by the searching module, perform MAC address learning, source MAC address information carried in the document, forwarding identifier found by the searching module, and the access port information or virtual port The information learns the MAC address table.
PCT/CN2011/072084 2010-03-26 2011-03-23 Method and network processor for implementing multi-service forwarding WO2011116695A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201010139684.5A CN101820392B (en) 2010-03-26 2010-03-26 A kind of method and network processing unit realizing multi-service forwarding
CN201010139684.5 2010-03-26

Publications (1)

Publication Number Publication Date
WO2011116695A1 true WO2011116695A1 (en) 2011-09-29

Family

ID=42655343

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/072084 WO2011116695A1 (en) 2010-03-26 2011-03-23 Method and network processor for implementing multi-service forwarding

Country Status (2)

Country Link
CN (1) CN101820392B (en)
WO (1) WO2011116695A1 (en)

Families Citing this family (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101820392B (en) * 2010-03-26 2015-08-12 中兴通讯股份有限公司 A kind of method and network processing unit realizing multi-service forwarding
CN102136931B (en) * 2010-09-20 2013-12-04 华为技术有限公司 Method for configuring virtual port network strategies, network management center and related equipment
CN102025800B (en) 2010-12-30 2013-04-24 华为技术有限公司 IP address allocation method and device
CN102307136B (en) * 2011-07-06 2014-12-24 杭州华三通信技术有限公司 Method for processing message and device thereof
CN103209141A (en) * 2012-01-17 2013-07-17 中兴通讯股份有限公司 Method for processing data messages with switching chip and switching chip
CN102546348B (en) * 2012-02-08 2015-06-03 中兴通讯股份有限公司 Method for network processor to achieve various three-layer interfaces and network processor
CN102611619B (en) * 2012-02-24 2018-03-20 中兴通讯股份有限公司 The method and routing device of a kind of forwarding data packets
CN103580893A (en) * 2012-07-31 2014-02-12 中兴通讯股份有限公司 Network processing unit configuration writing-in method and device based on packet transport network equipment
CN103581274B (en) 2012-08-09 2017-04-12 杭州华三通信技术有限公司 Message forwarding method and device in stacking system
CN104052660B (en) * 2013-03-11 2018-09-14 南京中兴软件有限责任公司 A kind of method and equipment that the multiple service supporting network equipment E-Packets
CN103384221A (en) * 2013-06-26 2013-11-06 汉柏科技有限公司 Method for optimizing service precedence message fast forwarding
CN105637815B (en) * 2014-09-10 2019-04-16 华为技术有限公司 A kind of data forwarding method, device and access device
CN105991428B (en) * 2015-03-05 2020-11-10 中兴通讯股份有限公司 Method and device for processing switch routing conflict
CN106302185A (en) * 2015-05-25 2017-01-04 中兴通讯股份有限公司 A kind of service message retransmission method, device and communication system
CN105591793B (en) * 2015-07-07 2019-01-18 新华三技术有限公司 A kind of fast-turn construction list item aging method and device
CN106487683A (en) * 2015-08-27 2017-03-08 中兴通讯股份有限公司 A kind of processing method and processing device of message
CN105207873B (en) * 2015-08-31 2019-02-26 华为技术有限公司 A kind of message processing method and device
CN107465617A (en) * 2016-06-02 2017-12-12 中兴通讯股份有限公司 The message transmission control method and communication network device of communication network device
CN107968749B (en) * 2017-11-21 2021-04-20 锐捷网络股份有限公司 Method for realizing QinQ route termination, switching chip and switch
CN109728992B (en) * 2018-11-27 2021-09-28 苏州盛科通信股份有限公司 Method, device, storage medium and electronic device for distributing forwarding domain

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6445709B1 (en) * 1999-05-13 2002-09-03 Advanced Micro Devices, Inc. Method and apparatus for finding a match entry using receive port number embedded in the port vector
CN1852240A (en) * 2005-10-19 2006-10-25 华为技术有限公司 Bridge-connection transmitting method
CN101083622A (en) * 2006-06-01 2007-12-05 富士通株式会社 System and method for managing forwarding database resources in a switching environment
US7609689B1 (en) * 2001-09-27 2009-10-27 Cisco Technology, Inc. System and method for mapping an index into an IPv6 address
CN101820392A (en) * 2010-03-26 2010-09-01 中兴通讯股份有限公司 Method for realizing multi-service forwarding and network processor

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6445709B1 (en) * 1999-05-13 2002-09-03 Advanced Micro Devices, Inc. Method and apparatus for finding a match entry using receive port number embedded in the port vector
US7609689B1 (en) * 2001-09-27 2009-10-27 Cisco Technology, Inc. System and method for mapping an index into an IPv6 address
CN1852240A (en) * 2005-10-19 2006-10-25 华为技术有限公司 Bridge-connection transmitting method
CN101083622A (en) * 2006-06-01 2007-12-05 富士通株式会社 System and method for managing forwarding database resources in a switching environment
CN101820392A (en) * 2010-03-26 2010-09-01 中兴通讯股份有限公司 Method for realizing multi-service forwarding and network processor

Also Published As

Publication number Publication date
CN101820392A (en) 2010-09-01
CN101820392B (en) 2015-08-12

Similar Documents

Publication Publication Date Title
WO2011116695A1 (en) Method and network processor for implementing multi-service forwarding
US9608833B2 (en) Supporting multiple multicast trees in trill networks
US9806906B2 (en) Flooding packets on a per-virtual-network basis
US9628293B2 (en) Network layer multicasting in trill networks
WO2020182086A1 (en) Bier packet sending method and apparatus
EP2541841B1 (en) Method for sending ethernet frames in ethernet tree service and provider edge device
WO2012167697A1 (en) Method and processor for suppressing network storm
WO2011035703A1 (en) Method and device for accessing internet protocol (ip)/layer-3 virtual private network (l3vpn) by layer-2 virtual private network (l2vpn)
WO2009033428A1 (en) Method, system and device for removing media access control address
WO2022048417A1 (en) Packet processing method, border device, and computer-readable storage medium
US20170195135A1 (en) Traffic black holing avoidance and fast convergence for active-active pbb-evpn redundancy
EP3095216B1 (en) Single hop overlay architecture for line rate performance in campus networks
WO2013139159A1 (en) Method for forwarding packet in network and provider edge device
WO2009021371A1 (en) A method and a device for implementing pseudo wire emulation edge to edge
WO2007076679A1 (en) A method and device for quality of service management based on virtual local area network stack
WO2012152186A1 (en) Multiport ethernet interface device and vpn service access method therefor
WO2023061061A1 (en) Message processing method, cable clip, device, and storage medium
WO2011120381A1 (en) Quality of service processing method and device for virtual private network traffic
Banerjee et al. Extensions to IS-IS for Layer-2 Systems
WO2020043106A1 (en) Communication method and communication device
WO2012155618A1 (en) Method and system for implementing vlan qinq
EP3113422B1 (en) Method and system of enhancing multiple mac registration protocol (mmrp) for protocol internetworking
WO2007093095A1 (en) A method for implementing mpls message forwarding and an equipment thereof
WO2007054025A1 (en) A data processing method in a bridged network, a network bridge and a bridged network
WO2011147233A1 (en) Method and device for realizing flow rate-limiting in virtual private network

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: 11758805

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: 11758805

Country of ref document: EP

Kind code of ref document: A1