Packet forwarding method and device, np chip, and network device
By setting up a message forwarding device in the data channel of the NP chip and using flow characteristic information to perform flow forwarding, the problem of high power consumption of pipeline processors is solved, and the power consumption of NP chips is reduced and the forwarding efficiency is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2024-12-31
- Publication Date
- 2026-06-30
AI Technical Summary
The pipeline processor in existing NP chips consumes a lot of power to forward message headers, resulting in high power consumption for NP chips.
By setting up a message forwarding device in the data channel, the flow characteristic information of the message is obtained and the flow forwarding is performed according to the flow table entry, thereby reducing the pipeline processing of the message and reducing power consumption.
By setting up a message forwarding device in the data channel, the power consumption of the NP chip is reduced and the efficiency of message forwarding is improved.
Smart Images

Figure CN122316979A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of network technology, and in particular to a message forwarding method and apparatus, a network processor (NP) chip, and network equipment. Background Technology
[0002] The NP chip in a network device includes a pipeline processor (PP) and a data path (DP). The pipeline processor processes the headers of network packets received by the data path to obtain a processed header; the data path obtains the processed network packet based on the original network packet and the processed header, and then sends the processed network packet.
[0003] However, the power consumption of pipelined processors in forwarding message headers is relatively high, which leads to a higher power consumption of NP chips. Summary of the Invention
[0004] This application provides a message forwarding method and apparatus, an NP chip, and a network device. The technical solution of this application is as follows.
[0005] In a first aspect, a message forwarding device is provided, applied to an NP chip, the NP chip including a pipeline processor and a data channel, the message forwarding device being located in the data channel, the message forwarding device being used to: acquire flow characteristic information of a first message received by the data channel; and perform flow forwarding of the first message based on the flow characteristic information of the first message.
[0006] The technical solution provided in this application sets up a message forwarding device in the data channel, which performs stream forwarding of messages. The power consumption of the message forwarding device in the data channel when performing stream forwarding of messages is relatively small, which helps to reduce the power consumption of the NP chip.
[0007] Optionally, the message forwarding device is configured to: determine a first flow forwarding table entry based on the flow characteristic information of the first message; and perform flow forwarding on the first message based on the first flow forwarding table entry. Wherein, the first flow forwarding table entry matches the flow characteristic information of the first message.
[0008] Optionally, the message forwarding device is used to: obtain first control information according to the first flow forwarding table entry; and perform flow forwarding on the first message according to the first control information.
[0009] Optionally, the first flow table entry includes a mapping relationship between the flow characteristic information of the first message and the index information of the first control information. The message forwarding device is used to: determine the index information of the first control information according to the first flow table entry; and obtain the first control information according to the index information of the first control information.
[0010] In the technical solution provided by this application, the message forwarding device determines the index information of the first control information according to the first flow forwarding entry, and obtains the first control information according to the index information of the first control information, which can facilitate the message forwarding device to perform flow forwarding on the first message according to the first control information.
[0011] Optionally, the message forwarding device includes a flow table matching module, a flow table data acquisition module, and a message processing module; the flow table matching module is configured to: obtain the flow feature information of the first message; determine the first flow forwarding entry in the flow forwarding table according to the flow feature information of the first message; determine the index information of the first control information according to the first flow forwarding entry; the flow table data acquisition module is configured to: obtain the first control information according to the index information of the first control information; the message processing module is configured to: perform flow forwarding on the first message according to the first control information.
[0012] Optionally, the flow table matching module is configured to: obtain the flow feature information carried by at least one message header of the first message; obtain the flow feature information of the first message based on the flow feature information obtained from the at least one message header. Wherein, the flow feature information of the first message includes the flow feature information carried by the at least one message header. For example, the flow feature information of the first message is formed by splicing the flow feature information carried by the at least one message header.
[0013] Optionally, the flow table matching module includes at least one flow feature extraction unit, and the at least one flow feature extraction unit corresponds to the at least one message header one by one; each flow feature extraction unit in the at least one flow feature extraction unit is configured to extract flow feature information from the corresponding message header.
[0014] Optionally, the at least one flow feature extraction unit is N flow feature extraction units, and the N flow feature extraction units are connected in series (that is, the N flow feature extraction units are connected in sequence), the at least one message header is N message headers, and N is an integer greater than 1; the i-th flow feature extraction unit in the N flow feature extraction units is further configured to: splice the flow feature information extracted by the i-th flow feature extraction unit from the corresponding message header and the flow feature information output by the (i - 1)-th flow feature extraction unit, and output the spliced flow feature information, 1 < i ≤ N, and i is an integer; wherein, the flow feature information of the first message is the flow feature information output by the N-th flow feature extraction unit.
[0015] Optionally, the at least one flow feature extraction unit is N flow feature extraction units, and the N flow feature extraction units are connected in parallel, the at least one message header is N message headers, and N is an integer greater than 1; the flow table matching module further includes a splicing unit, and the splicing unit is configured to: splice the flow feature information extracted by the N flow feature extraction units from the N message headers to obtain the flow feature information of the first message.
[0016] Optionally, the flow table matching module includes a lookup unit; the lookup unit is used to: determine the first flow table entry in the flow forwarding table based on the flow characteristic information of the first message. That is, the lookup unit searches the flow table based on the flow characteristic information of the first message to determine the first flow table entry.
[0017] Optionally, the first message belongs to the first flow, and the first flow forwarding table entry is a forwarding table entry used for forwarding the first flow. The first flow forwarding table entry is generated by the pipeline processor. After generating the first flow forwarding table entry, the pipeline processor sends the first flow forwarding table entry to the message forwarding device. The message forwarding device is also used to receive the first flow forwarding table entry sent by the pipeline processor. For example, the first flow forwarding table entry includes the mapping relationship between the flow characteristic information of the first message and the index information of the first control information. After generating the first flow forwarding table entry, the pipeline processor also sends the first control information to the message forwarding device. The message forwarding device is also used to receive the first control information sent by the pipeline processor.
[0018] Optionally, the packet forwarding device includes a flow table matching module and a flow table data acquisition module. The pipeline processor sends a first flow table entry to the flow table matching module, and the pipeline processor sends first control information to the flow table data acquisition module. Correspondingly, the flow table matching module is used to receive the first flow table entry sent by the pipeline processor, and the flow table data acquisition module is used to receive the first control information sent by the pipeline processor.
[0019] Optionally, the first-rate flow is the elephant flow. That is, the first-rate flow has a larger volume.
[0020] The technical solution provided in this application generates flow table entries for large data streams, which can avoid generating flow table entries for smaller data streams, thus helping to reduce the size of the flow table.
[0021] Optionally, the first flow table entry is generated by the pipeline processor based on the header of the second message received by the data channel, and the second message belongs to the first flow; the message forwarding device is also used to: obtain the flow characteristic information of the second message received by the data channel; determine that the flow characteristic information of the second message does not hit the flow table, and send the header of the second message to the pipeline processor.
[0022] The technical solution provided in this application allows the message forwarding device to send the header of the second message to the pipeline processor when the flow characteristic information of the second message belonging to the first flow does not hit the flow table. This facilitates the pipeline processor to generate a first flow table entry based on the header of the second message, thereby enabling subsequent flow forwarding of the first-order messages based on the first flow table entry.
[0023] Optionally, the first flow table entry is generated by the pipeline processor when it determines that the number of first-order packets among the packets received by the data channel reaches a preset number. For example, for each packet belonging to the first order received by the data channel: the packet forwarding device searches the flow table based on the packet's flow characteristic information; if the flow characteristic information of the packet does not match the flow table, the packet forwarding device sends the packet header to the pipeline processor; the pipeline processor forwards the packet header, and during the forwarding process of the packet header belonging to the first order, the pipeline processor counts the number of packets belonging to the first order; the pipeline processor generates the first flow table entry when it determines that the number of first-order packets reaches a preset number.
[0024] The technical solution provided in this application generates a first flow table entry when the number of first-order messages in the data channel reaches a preset number. This avoids generating flow table entries for data streams with small traffic volumes and helps reduce the size of the flow table.
[0025] Secondly, a message forwarding method is provided, applied to a message forwarding device in an NP chip. The NP chip includes a pipeline processor and a data channel, with the message forwarding device located in the data channel. The method includes: the message forwarding device acquiring flow characteristic information of a first message received by the data channel; and the message forwarding device performing flow forwarding on the first message based on the flow characteristic information of the first message.
[0026] Optionally, the message forwarding device performs flow forwarding on the first message based on the flow characteristic information of the first message, including: the message forwarding device determines a first flow forwarding table entry in the flow forwarding table based on the flow characteristic information of the first message; the message forwarding device performs flow forwarding on the first message based on the first flow forwarding table entry.
[0027] Optionally, the message forwarding device performs flow forwarding on the first message according to the first flow table entry, including: the message forwarding device obtains first control information according to the first flow table entry; the message forwarding device performs flow forwarding on the first message according to the first control information.
[0028] Optionally, the first flow table entry includes a mapping relationship between the flow characteristic information of the first message and the index information of the first control information; the message forwarding device obtains the first control information according to the first flow table entry, including: the message forwarding device determines the index information of the first control information according to the first flow table entry; the message forwarding device obtains the first control information according to the index information of the first control information.
[0029] Optionally, the packet forwarding device includes a flow table matching module, a flow table data acquisition module, and a packet processing module; the packet forwarding device acquires the flow feature information of the first packet received by the data channel, including: the flow table matching module acquires the flow feature information of the first packet;
[0030] The packet forwarding device determines the first flow forwarding entry in the flow forwarding table according to the flow feature information of the first packet, including: the flow table matching module determines the first flow forwarding entry in the flow forwarding table according to the flow feature information of the first packet;
[0031] The packet forwarding device determines the index information of the first control information according to the first flow forwarding entry, including: the flow table matching module determines the index information of the first control information according to the first flow forwarding entry;
[0032] The packet forwarding device acquires the first control information according to the index information of the first control information, including: the flow table data acquisition module acquires the first control information according to the index information of the first control information;
[0033] The packet forwarding device performs flow forwarding on the first packet according to the first control information, including: the packet processing module performs flow forwarding on the first packet according to the first control information.
[0034] Optionally, the flow table matching module acquires the flow feature information of the first packet, including: the flow table matching module acquires the flow feature information carried by at least one packet header of the first packet; the flow table matching module acquires the flow feature information of the first packet based on the flow feature information obtained from the at least one packet header.
[0035] Optionally, the flow table matching module includes at least one flow feature extraction unit, and the at least one flow feature extraction unit corresponds to the at least one packet header one by one; the flow table matching module acquires the flow feature information carried by at least one packet header of the first packet, including: each flow feature extraction unit in the at least one flow feature extraction unit extracts flow feature information from the corresponding packet header.
[0036] Optionally, the at least one flow feature extraction unit is N flow feature extraction units, the N flow feature extraction units are connected in series, the at least one packet header is N packet headers, and N is an integer greater than 1; the flow table matching module acquires the flow feature information of the first packet based on the flow feature information obtained from the at least one packet header, including: the i-th flow feature extraction unit among the N flow feature extraction units splices the flow feature information extracted by the i-th flow feature extraction unit from the corresponding packet header and the flow feature information output by the (i - 1)-th flow feature extraction unit, and outputs the spliced flow feature information, 1 < i ≤ N, and i is an integer; wherein, the flow feature information of the first packet is the flow feature information output by the N-th flow feature extraction unit.
[0037] Optionally, the at least one flow feature extraction unit is N flow feature extraction units connected in parallel, and the at least one packet header is N packet headers, where N is an integer greater than 1; the flow table matching module further includes a splicing unit, which obtains the flow feature information of the first packet based on the flow feature information obtained from the at least one packet header, including: the splicing unit splices the flow feature information extracted from the N packet headers by the N flow feature extraction units to obtain the flow feature information of the first packet.
[0038] Optionally, the flow table matching module includes a lookup unit; the flow table matching module determines the first flow table entry in the flow forwarding table based on the flow characteristic information of the first packet, including: the lookup unit determines the first flow table entry in the flow forwarding table based on the flow characteristic information of the first packet.
[0039] Optionally, the first message belongs to the first stream, the first stream forwarding table entry is a forwarding table entry used to forward the first stream, and the first stream forwarding table entry is generated by the pipeline processor; the method further includes: the message forwarding device receiving the first stream forwarding table entry sent by the pipeline processor.
[0040] Optional, the first-rate is the elephant flow.
[0041] Optionally, the first flow table entry is generated by the pipeline processor based on the header of the second message received by the data channel. The second message belongs to the first flow. The method further includes: the message forwarding device obtaining the flow characteristic information of the second message received by the data channel; the message forwarding device determining that the flow characteristic information of the second message does not match the flow table, and sending the header of the second message to the pipeline processor.
[0042] Optionally, the first stream table entry is generated by the pipeline processor when it determines that the number of first-order messages among the messages received by the data channel reaches a preset number.
[0043] Thirdly, an NP chip is provided, including a pipelined processor and a data channel, the data channel including message forwarding means as provided in the first aspect or any alternative to the first aspect. The NP chip may include programmable logic circuitry and / or program instructions.
[0044] Fourthly, a network device is provided, including the NP chip as provided in the third aspect.
[0045] The network equipment can be a switch, router, firewall, base station, or wireless local area network (WLAN) device. The base station can include 5G base stations, 6G base stations, etc.
[0046] This network device is a high-bandwidth network device.
[0047] Fifthly, a computer-readable storage medium is provided that stores a computer program, which, when executed, implements at least some steps of the method provided as described in the second aspect or any alternative method of the second aspect.
[0048] In a sixth aspect, a computer program product is provided, comprising a program or code that, when executed, implements at least some steps of the method provided as described in the second aspect or any alternative method of the second aspect.
[0049] The technical effects of the second to sixth aspects mentioned above can be referred to the technical effects of the first aspect and its optional implementation methods, and will not be elaborated here. Attached Figure Description
[0050] Figure 1 This is a schematic diagram of an NP chip provided in an embodiment of this application;
[0051] Figure 2 This is a schematic diagram of a link layer packet header provided in an embodiment of this application;
[0052] Figure 3 This is a schematic diagram of an IPv4 header provided in an embodiment of this application;
[0053] Figure 4 This is a schematic diagram of a TCP header provided in an embodiment of this application;
[0054] Figure 5 This is a schematic diagram of another NP chip provided in an embodiment of this application;
[0055] Figure 6 This is a schematic diagram of a flow table matching module provided in an embodiment of this application;
[0056] Figure 7 This is a schematic diagram of another flow table matching module provided in an embodiment of this application;
[0057] Figure 8 This is a flowchart of a message forwarding method provided in an embodiment of this application;
[0058] Figure 9 This is a schematic diagram of a network device provided in an embodiment of this application. Detailed Implementation
[0059] The embodiments of this application will now be described in further detail with reference to the accompanying drawings.
[0060] A network processor (NP) chip is a chip in a network device used to forward packets. Typically, NP chips can use programmable forwarding logic, hardened forwarding logic, or a combination of both for packet forwarding. This forwarding logic usually only processes the packet header. For example, network devices include switches or routers. In switches, the forwarding logic in the NP chip only processes the link-layer header. In routers, the forwarding logic in the NP chip only processes the Internet Protocol (IP) header.
[0061] For example, the NP chip includes a pipeline processor (PP) and a datapath (DP), which are communicatively connected. The pipeline processor is used to forward the headers of network packets received by the datapath to obtain processed headers. The datapath is used to: buffer the network packets received by the datapath, obtain processed network packets based on the processed headers of the network packets and the buffered network packets, and send the processed network packets.
[0062] However, during the forwarding of network packet headers, the pipelined processor needs to perform a complete pipelined processing flow on the packet header, resulting in high power consumption for the pipelined processor and consequently, high power consumption for the NP chip. Specifically, the pipelined processor includes a packet processing pipeline comprising multiple processing nodes (e.g., match-action (MA) nodes), each node performing one operation from the pipelined processing flow on the packet header. During the forwarding process, the packet header must pass through these multiple processing nodes sequentially (even if no specific operation is required on the packet header, it still needs to pass through that node), leading to high power consumption for the pipelined processor.
[0063] Furthermore, before forwarding the header of a network packet, each processing node in the packet processing pipeline needs to read the data required for forwarding that header into the memory of that pipeline processor. Since the data required for forwarding different headers by the same processing node is usually different, this necessitates continuous memory flipping (i.e., the data in the pipeline processor's memory needs to change constantly). Memory flipping also consumes power, resulting in relatively high power consumption for the pipeline processor.
[0064] Furthermore, NP chips typically include multiple packet processing engines (e.g., 2, 3, or 6). Each packet processing engine includes a pipeline processor and a data channel. The pipeline processor in each packet processing engine is used to forward the headers of network packets received by the data channel of that engine. The high power consumption of the pipeline processor leads to the high power consumption of the packet processing engine, which in turn leads to the high power consumption of the NP chip. For example, the power consumption of a single packet processing engine can typically reach the 100W level, and the power consumption of the corresponding forwarding table entry can reach 50W. When an NP chip includes multiple packet processing engines, its power consumption will be even higher.
[0065] In a current packet forwarding scheme, the pipelined processor uses a full-service forwarding method to process the packet headers of network packets. Specifically, the pipelined processor forwards the packet headers by looking up a series of service forwarding tables, such as the IP forwarding table and the Media Access Control (MAC) forwarding table. Because the pipelined processor needs to look up a series of service forwarding tables during the packet header forwarding process, this packet forwarding method is called the full-service forwarding method. However, in this packet forwarding scheme, on the one hand, the pipelined processor itself consumes a lot of power in processing the packet headers (the pipelined processor needs to perform a complete pipelined processing flow on the packet headers during the forwarding process); on the other hand, the pipelined processor needs to look up a series of service forwarding tables during the process of forwarding the packet headers, and the power consumption of looking up these service forwarding tables is also high. As a result, the overall power consumption of the pipelined processor is high, and the power consumption of the NP chip is also high.
[0066] In another current packet forwarding scheme, the pipeline processor uses flow table forwarding and full-service forwarding methods to forward the packet headers of network packets. Specifically, the pipeline processor includes a flow table and a series of service forwarding tables. The flow table includes at least one flow table entry, and each flow table entry includes a mapping relationship between flow feature information and at least one forwarding operation information. Each forwarding operation information in the at least one forwarding operation information is used to indicate a forwarding operation to be performed on the packet header with the corresponding flow feature information. For any network packet received by any data channel: the pipeline processor corresponding to the data channel first looks up the flow table based on the flow feature information of the network packet; if the flow feature information of the network packet hits a flow table entry in the flow table, the pipeline processor forwards the packet header according to the flow table entry hit by the flow feature information of the network packet; if the flow feature information of the network packet does not hit a flow table entry in the flow table, the pipeline processor forwards the packet header by looking up the series of service forwarding tables. As can be seen, when the flow characteristic information of a network packet matches a flow table entry, the pipelined processor only needs to forward the packet header according to that entry, without needing to use full-service forwarding. Therefore, the pipelined processor has high performance in forwarding packet headers. However, in this packet forwarding scheme, the pipelined processor still processes the packet header, resulting in relatively high power consumption for both the pipelined processor and the NP chip. Furthermore, the flow table needs to cover various data streams, leading to a large flow table size.
[0067] This application provides a packet forwarding method and apparatus, an NP chip, and a network device. The packet forwarding apparatus is applied to an NP chip, which includes a pipeline processor and a data channel, with the packet forwarding apparatus located within the data channel. After acquiring the flow characteristic information of a first packet received by the data channel, the packet forwarding apparatus performs flow forwarding on the first packet based on the flow characteristic information. Therefore, this application provides a packet forwarding apparatus within the data channel, which performs flow forwarding of packets. Compared to packet forwarding by a pipeline processor, the power consumption of this packet forwarding apparatus is lower (it does not require executing a complete pipeline processing flow), thus helping to reduce the power consumption of the NP chip.
[0068] The message forwarding device provided in this application is applied to an NP chip. The message forwarding device of this application will be described below in conjunction with an NP chip.
[0069] Please refer to Figure 1This illustrates a schematic diagram of an NP chip 10 provided in an embodiment of this application. For example... Figure 1 As shown, the packet forwarding device 120 is applied to the NP chip 10. The NP chip 10 includes a pipeline processor 11 and a data channel 12. The pipeline processor 11 is communicatively connected to the data channel 12, and the packet forwarding device 120 is located in the data channel 12. For example, the NP chip 10 includes multiple packet processing engines (...). Figure 1 (Not shown in the text), each packet processing engine includes a pipeline processor and a data channel. In each packet processing engine, the pipeline processor and the data channel are communicatively connected. The pipeline processor 11 and the data channel 12 are located in the same packet processing engine of the NP chip 10. In an optional embodiment, in at least one packet processing engine of the NP chip 10, the data channel includes the message forwarding device 120 as provided in the embodiments of this application.
[0070] In this embodiment, the message forwarding device 120 is configured to: acquire flow characteristic information of a first message received by the data channel 12; and perform flow forwarding on the first message based on the flow characteristic information of the first message. The first message is any message received by the data channel 12. The flow characteristic information of the first message is the characteristic information of the data stream to which the first message belongs, and is used to characterize the data stream to which the first message is sent. For example, if the first message belongs to a first stream, the flow characteristic information of the first message is the characteristic information of the first stream, and is used to characterize the first stream. In some embodiments, the flow characteristic information is also called flow attribute information or flow information, and this embodiment does not limit this usage.
[0071] In an optional embodiment, the first message carries flow characteristic information, and the flow characteristic information of the first message is determined based on the flow characteristic information carried in the first message. For example, the first message includes at least one message header, each message header carrying flow characteristic information, and the message forwarding device 120 is configured to: obtain the flow characteristic information carried in the at least one message header, and obtain the flow characteristic information of the first message based on the flow characteristic information obtained from the at least one message header. In one embodiment, the at least one message header is a single message header, and the message forwarding device 120 determines the flow characteristic information of the first message from the flow characteristic information obtained from the single message header. In another embodiment, the at least one message header is multiple message headers, and the message forwarding device 120 concatenates the flow characteristic information obtained from the multiple message headers to obtain the flow characteristic information of the first message.
[0072] In an optional embodiment, the packet forwarding device 120 includes at least one flow feature template, which corresponds one-to-one with the at least one packet header. Each flow feature template is designed according to the characteristics of the corresponding packet header and is used to obtain flow feature information from the corresponding packet header. The packet forwarding device 120 is used to obtain the flow feature information carried by each packet header according to the flow feature template corresponding to each packet header in the at least one packet header. For example, the packet forwarding device 120 extracts flow feature information from each packet header according to the flow feature template corresponding to each packet header in the at least one packet header.
[0073] In this embodiment, the at least one message header includes various possible protocol layer headers such as a link layer header, an IP layer header, and a transport layer header. The link layer header is also called the Ethernet header. The IP layer header is also called the network layer header, and it may include an Internet Protocol version 4 (IPv4) header, an Internet Protocol version 6 (IPv6) header, or a Multiprotocol Label Switching (MPLS) header. The transport layer header may include a Transmission Control Protocol (TCP) header or a User Datagram Protocol (UDP) header.
[0074] For an example, please refer to Figure 2 The diagram illustrates a link-layer packet header. This header includes: a Destination Media Access Control (DMAC) field, a Source Media Access Control (SMAC) field, two Virtual Local Area Network (VLAN) tag fields, and three type fields. The DMAC field carries the DMAC address. The SMAC field carries the SMAC address. The two VLAN tag fields include VLAN tag field 1 (i.e.,...) Figure 2 VLAN tag 1) and VLAN tag 2 (i.e. Figure 2 The VLAN tag field (2) is one of the two VLAN tag fields, each carrying a layer of VLAN tag. The three type fields include type field 1 (i.e.,...). Figure 2 Type 1 and Type Field 2 (i.e.) Figure 2Type 2) and Type Field 3 (i.e. Figure 2 In type 3), type field 1 is used to indicate VLAN tag field 1 (type field 1 is used to indicate that the field following type field 1 is a VLAN tag field), and type field 2 is used to indicate VLAN tag field 2 (type field 2 is used to indicate that the field following type field 2 is a VLAN tag field).
[0075] For example Figure 2 The link-layer header shown uses DMAC address, SMAC address, VLAN tag 1, and VLAN tag 2 to characterize data flows. These elements are all flow characteristic information. For ease of description, the flow characteristic template corresponding to the link-layer header is called the link-layer flow characteristic template. The link-layer flow characteristic template can include at least one of the following fields: DMAC address field, SMAC address field, VLAN tag field 1, and VLAN tag field 2. For example, a link-layer flow characteristic template can be designed according to two layers of VLAN tags, including VLAN tag field 1 and VLAN tag field 2. For link-layer headers that only include one layer of VLAN tags or do not include VLAN tags, when obtaining flow characteristic information from these link-layer headers according to this link-layer flow characteristic template (i.e., a link-layer flow characteristic template including two layers of VLAN tags), the values of VLAN tag fields that are not present in these link-layer headers can be set to default values (e.g., 0). Finally, the flow characteristic information obtained from these link-layer headers can be processed into a structure including two layers of VLAN tags. In a specific example, the link-layer flow feature template includes a DMAC field, an SMAC field, two VLAN tag fields, and three type fields. The structure of this link-layer flow feature template is similar to... Figure 2The same applies. For a link-layer packet header that includes only one layer of VLAN tags (e.g., VLAN tag 1), during the process of obtaining flow feature information from the link-layer packet header according to the link-layer flow feature template, the packet forwarding device 120 obtains the DMAC address, SMAC address, and VLAN tag 1 carried in the link-layer packet header. Furthermore, the packet forwarding device 120 sets the flow feature information obtained from the link-layer packet header to include the VLAN tag field 2, and sets the value of the VLAN tag field 2 to the default value. Thus, the flow feature information obtained by the packet forwarding device 120 from the link-layer packet header is a structure including two layers of VLAN tags. For a link-layer header that does not include VLAN tags, during the process of obtaining flow feature information from the link-layer header according to the link-layer flow feature template, the packet forwarding device 120 obtains the DMAC address and SMAC address carried in the link-layer header. Furthermore, the packet forwarding device 120 sets the flow feature information obtained from the link-layer header to include VLAN tag field 1 and VLAN tag field 2. The packet forwarding device 120 sets the values of VLAN tag field 1 and VLAN tag field 2 to default values. Thus, the flow feature information obtained by the packet forwarding device 120 from the link-layer header is a structure including two layers of VLAN tags.
[0076] For an example, please refer to Figure 3 This diagram illustrates an IPv4 header. The IPv4 header includes: a version field, a head length field, a type of service (TOS) field, a total length field, an identification (ID) field, a flags field, a fragment offset field, a time to live (TTL) field, a protocol field, a header checksum field, a source IP address field, and a destination IP address field. The version field carries version information. The head length field carries the length of the IPv4 header. The TOS field carries the TOS. The total length field carries the total length of the IP packet including this IPv4 header. The identification field carries the identifier of the IP packet including this IPv4 header. The fragment offset field carries the fragment offset. The TTL field carries the TTL. The protocol field carries the protocol. The header checksum field carries the checksum of this IPv4 header. The source IP address field carries the source IP address. The destination IP address field carries the destination IP address.
[0077] For example Figure 3 The IPv4 header shown includes version, header length, TOS, protocol, source IP address, and destination IP address, all of which can be used to characterize a data flow. Version, header length, TOS, protocol, source IP address, and destination IP address are all flow characteristic information. For ease of description, the flow characteristic template corresponding to the IPv4 header is referred to as the IPv4 flow characteristic template. The IPv4 flow characteristic template may include at least one of the following fields: version field, header length field, TOS field, protocol field, source IP address field, or destination IP address field. In one embodiment, the IPv4 flow characteristic template includes a version field, header length field, TOS field, protocol field, source IP address field, and destination IP address field. During the process of the packet forwarding device 120 obtaining flow characteristic information from the IPv4 header according to the IPv4 flow characteristic template, the packet forwarding device 120 obtains the version, header length, TOS, protocol, source IP address, and destination IP address from the IPv4 header. In another embodiment, the IPv4 flow feature template includes a version field, header length field, TOS field, total length field, identifier field, flag field, fragment offset field, TTL field, protocol field, header checksum field, source IP address field, and destination IP address field. The structure of this IPv4 flow feature template is similar to... Figure 3 Similarly, during the process of obtaining flow feature information from the IPv4 header according to the IPv4 flow feature template, the packet forwarding device 120 obtains the version, header length, TOS, protocol, source IP address, and destination IP address from the IPv4 header. Furthermore, the packet forwarding device 120 sets the values of the total length field, identifier field, flag field, fragmentation offset field, TTL field, and header checksum field to their default values. For example, the values of the total length field, identifier field, flag field, fragmentation offset field, TTL field, and header checksum field are all masked as 0.
[0078] For an example, please refer to Figure 4The diagram illustrates a TCP header. This TCP header includes: a source port number field, a destination port number field, a request sequence number field, an acknowledgment sequence number field, a header length field, a reserved field, an urgent (URG) flag, an acknowledgment (ACK) flag, a push (PSH) flag, a reset (RST) flag, a synchronized (SYN) flag, a finish (FIN) flag, a window size field, a checksum field, and an urgent pointer field. The source port number field carries the source port number. The destination port number field carries the destination port number. The request sequence number field carries the request sequence number. The acknowledgment sequence number field carries the acknowledgment sequence number. The header length field carries the header length. The URG flag carries the URG flag. The ACK flag carries the ACK flag. The PSH flag carries the PSH flag. The RST flag carries the RST flag. The SYN flag carries the SYN flag. The FIN flag carries the FIN flag. The window size field carries the window size. The checksum field carries the checksum. The urgent pointer field carries the urgent pointer.
[0079] For example Figure 4 The TCP header shown, including both the source and destination port numbers, can be used to characterize the data flow; both are flow characteristic information. For ease of description, the flow characteristic template corresponding to the TCP header is referred to as the TCP flow characteristic template. The TCP flow characteristic template may include at least one of the following fields: a source port number field or a destination port number field. In one embodiment, the TCP flow characteristic template includes a source port number field and a destination port number field. During the process of the packet forwarding device 120 obtaining flow characteristic information from the TCP header according to the TCP flow characteristic template, the packet forwarding device 120 obtains the source and destination port numbers from the TCP header. In another embodiment, the TCP flow characteristic template includes a source port number field, a destination port number field, a request sequence number field, an acknowledgment sequence number field, a header length field, a reserved field, a URG flag, an ACK flag, a PSH flag, an RST flag, a SYN flag, a FIN flag, a window size field, a checksum field, and an urgent pointer field. The structure of this TCP flow characteristic template is similar to... Figure 4The process is the same; during the process of obtaining flow characteristic information from the TCP header according to the TCP flow characteristic template, the message forwarding device 120 obtains the source port number and destination port number from the TCP header. Furthermore, the message forwarding device 120 sets the values of the request sequence number field, acknowledgment sequence number field, header length field, reserved field, URG flag, ACK flag, PSH flag, RST flag, SYN flag, FIN flag, window size field, checksum field, and urgent pointer field to their default values. For example, the message forwarding device 120 masks the values of the request sequence number field, acknowledgment sequence number field, header length field, reserved field, URG flag, ACK flag, PSH flag, RST flag, SYN flag, FIN flag, window size field, checksum field, and urgent pointer field to 0. It should be noted that this example uses the source port number and destination port number carried in the TCP header as an example. Depending on the service characteristics, at least one of the URG flag, ACK flag, PSH flag, RST flag, SYN flag or FIN flag can also be used as flow characteristic information. This application embodiment does not limit this.
[0080] After obtaining the flow characteristic information of the first packet, the packet forwarding device 120 performs flow forwarding on the first packet based on the flow characteristic information. In a specific embodiment, the packet forwarding device 120 is configured to: determine a first flow forwarding table entry based on the flow characteristic information of the first packet; and perform flow forwarding on the first packet based on the first flow forwarding table entry. The first flow forwarding table entry matches the flow characteristic information of the first packet. For example, the first flow forwarding table entry includes the flow characteristic information of the first packet, such that the first flow forwarding table entry matches the flow characteristic information of the first packet. In a specific embodiment, the packet forwarding device 120 is configured to: search the flow forwarding table based on the flow characteristic information of the first packet to determine the flow forwarding table entry (i.e., the first flow forwarding table entry) that matches the flow characteristic information of the first packet.
[0081] After determining the first flow table entry, the message forwarding device 120 performs flow forwarding on the first message according to the first flow table entry. In a specific embodiment, the message forwarding device 120 is used to: obtain first control information according to the first flow table entry; and perform flow forwarding on the first message according to the first control information. In one embodiment, the first flow table entry includes a mapping relationship between the flow characteristic information of the first message and the index information of the first control information. The message forwarding device 120 is used to: determine the index information of the first control information according to the first flow table entry; obtain the first control information according to the index information of the first control information; and perform flow forwarding on the first message according to the first control information. For example, the first control information is stored in the memory of the NP chip 10. The message forwarding device 120 obtains the first control information from the memory of the NP chip 10 according to the index information of the first control information, and then performs flow forwarding on the first message according to the first control information.
[0082] In this embodiment, the first control information includes at least one sub-control information, each sub-control information including forwarding operation information, and some sub-control information may also include editing data. Each forwarding operation information is used to indicate a forwarding operation, which may include an editing operation. For any sub-control information including forwarding operation information and editing data, the forwarding operation information in the sub-control information is used to indicate a forwarding operation, and the editing data in the sub-control information is used to indicate the operation content of the forwarding operation; for example, the sub-control information is used to indicate editing of the message according to the editing data. The message forwarding device 120 performs flow forwarding of the first message according to the at least one sub-control information. In a specific embodiment, for each sub-control information in the at least one sub-control information: the message forwarding device 120 performs a forwarding operation on the first message according to the forwarding operation information in the sub-control information; when the sub-control information also includes editing data, the operation content of the message forwarding device 120 performing the forwarding operation on the first message includes the editing data. That is, for any sub-control information including forwarding operation information and editing data, the message forwarding device 120 edits the first message according to the sub-control information.
[0083] In an optional embodiment, the first control information includes multiple sub-control information, which are arranged in sequence. The packet forwarding device 120 performs flow forwarding on the first packet according to the sorting order of the multiple sub-control information.
[0084] As an example, the first control information includes sub-control information 1 to M, arranged sequentially, where M is a positive integer. For example, the first control information is "sub-control information 1 / sub-control information 2 / sub-control information 3 / ... / sub-control information M". Sub-control information 1 includes forwarding operation information 11 and editing data 12, sub-control information 2 includes forwarding operation information 21 and editing data 22, sub-control information 3 includes forwarding operation information 31, and so on. Sub-control information M includes forwarding operation information M1 and editing data M2. This is illustrated by taking forwarding operation information 11 as an indication of forwarding operation 11, forwarding operation information 21 as an indication of forwarding operation 21, forwarding operation information 31 as an indication of forwarding operation 31, and so on, with forwarding operation information M1 indicating forwarding operation M1. The message forwarding device 120 performs flow forwarding on the first message according to the first control information, including: First, the message forwarding device 120 performs forwarding operation 11 on the first message according to forwarding operation information 11, the operation content of forwarding operation 11 including editing data 12; then, the message forwarding device 120 performs forwarding operation 21 on the first message according to forwarding operation information 21 and editing data 22, the operation content of forwarding operation 21 including editing data 22; then, the message forwarding device 120 performs forwarding operation 31 on the first message according to forwarding operation information 31; and so on; finally, the message forwarding device 120 performs forwarding operation M1 on the first message according to forwarding operation information M1 and editing data M2, the operation content of forwarding operation M1 including editing data M2.
[0085] In a specific example, M equals 4, sub-control information M is sub-control information 4, forwarding operation information M1 is forwarding operation information 41, and edit data M2 is edit data 42. Forwarding operation information 11 is deletion operation information, used to indicate a deletion operation. Edit data 12 is the length x1 to be deleted. Sub-control information 1, including forwarding operation information 11 and edit data 12, is used to indicate the deletion of content of length x1 from the message; for example, sub-control information 1 indicates the deletion of content of length x1 starting from the beginning of the message header. Forwarding operation information 21 is addition operation information, used to indicate an addition operation. Edit data 22 is the content to be added. Sub-control information 2, including forwarding operation information 21 and edit data 22, is used to indicate the addition of edit data 22 to the message; for example, sub-control information 2 indicates the addition of edit data 22 starting from the beginning of the message header. Forwarding operation information 31 is an IPv4 TTL-- enable flag, used to instruct the execution of IPv4 TTL-- on IPv4 packets with IPv4 TTL-- enabled. Forwarding operation information 41 is IPv4 TOS replacement operation information, used to instruct the IPv4 TOS replacement operation. Editing data 42 is the IPv4 TOS value to be replaced. Sub-control information 4, including forwarding operation information 41 and editing data 42, is used to instruct the replacement of the TOS value of the IPv4 packet with editing data 42. Taking an IPv4 packet as an example, the first packet includes an Ethernet header and an IPv4 header. First, according to sub-control information 1, the packet forwarding device 120 deletes content of length x1 from the first packet, starting from the beginning of the header. Then, according to sub-control information 2, the packet forwarding device 120 adds editing data 22 to the first packet, starting from the beginning of the header. Next, according to sub-control information 3, the packet forwarding device 120 checks whether IPv4 TTL-- is enabled in the first packet; if IPv4 TTL-- is enabled in the first packet, the packet forwarding device 120 performs IPv4 TTL-- on the first packet (that is, decrements the TTL in the IPv4 header of the first packet by 1); if IPv4 TTL-- is not enabled in the first packet, the packet forwarding device 120 does not perform IPv4 TTL-- on the first packet, and the packet forwarding device 120 skips sub-control information 3. Finally, according to sub-control information 4, the packet forwarding device 120 replaces the TOS value in the IPv4 header of the first packet with edit data 42 (that is, the IPv4 TOS value to be replaced).After performing IPv4 TTL-- on the first packet and replacing the TOS value in the IPv4 header of the first packet with edit data 42, the packet forwarding device 120 recalculates the checksum of the IPv4 header of the first packet and updates the header checksum in the IPv4 header with the recalculated checksum. As an example, both the content of length x1 and the edit data 12 are Ethernet headers. For example, the content of length x1 is called the first Ethernet header, and the edit data 12 is called the second Ethernet header. That is, the packet forwarding device 120 deletes the Ethernet header (i.e., the first Ethernet header) of the first packet according to the sub-control information 1, and then adds the second Ethernet header to the first packet.
[0086] For IPv4 TOS replacement operations, this application embodiment illustrates an example where the sub-control information includes IPv4 TOS replacement operation information and the IPv4 TOS value to be replaced. In some embodiments, the sub-control information only includes the IPv4 TOS value to be replaced. This IPv4 TOS value serves both as the content to be replaced and as an indication of the IPv4 TOS replacement operation. That is, for a replacement operation, the sub-control information may only include the parameter value to be replaced, and this parameter value is used to indicate the replacement operation. This application embodiment does not limit this approach.
[0087] In an optional embodiment, the first control information includes information about the output port of the first message (e.g., the port number of the output port). The message forwarding device 120 performs flow forwarding of the first message according to the first control information, and further includes: the message forwarding device 120 determines the output port of the first message according to the information about the output port of the first message, and the message forwarding device 120 sends the first message through the output port of the first message.
[0088] In an optional embodiment, please refer to Figure 5 This illustrates a schematic diagram of another NP chip 10 provided in an embodiment of this application. For example... Figure 5 As shown, the packet forwarding device 120 includes a flow table matching module 121, a flow table data acquisition module 122, and a packet processing module 123. The flow table matching module 121, the flow table data acquisition module 122, and the packet processing module 123 are connected sequentially. The flow table matching module 121 is used to: acquire the flow characteristic information of a first packet; determine a first flow forwarding table entry based on the flow characteristic information of the first packet; and determine the index information of first control information based on the first flow forwarding table entry. The flow table data acquisition module 122 is used to acquire first control information based on the index information of the first control information. The packet processing module 123 is used to: perform flow forwarding on the first packet based on the first control information. During the flow forwarding process of the first packet, the packet processing module 123 can edit the first packet; therefore, the packet processing module 123 can also be called an editor module.
[0089] In a specific embodiment, the first message includes at least one message header, each of which carries flow characteristic information. The flow table matching module 121 is used to: obtain the flow characteristic information carried by the at least one message header; obtain the flow characteristic information of the first message based on the flow characteristic information obtained from the at least one message header; and search the flow forwarding table according to the flow characteristic information of the first message to determine the first flow forwarding table entry. In one embodiment, the at least one message header is a single message header, and the flow table matching module 121 determines the flow characteristic information of the first message from the flow characteristic information obtained from the single message header. In another embodiment, the at least one message header is multiple message headers, and the flow table matching module 121 concatenates the flow characteristic information obtained from the multiple message headers to obtain the flow characteristic information of the first message.
[0090] In an optional embodiment, the flow table matching module 121 is used to extract flow feature information from each of the at least one packet header. For example, the flow table matching module 121 includes at least one flow feature extraction unit, which corresponds one-to-one with the at least one packet header, and each flow feature extraction unit is used to extract flow feature information from the corresponding packet header. In a specific embodiment, the at least one flow feature extraction unit corresponds one-to-one with the at least one flow feature template, and each flow feature extraction unit is used to extract flow feature information from the packet header corresponding to each flow feature extraction unit according to the flow feature template corresponding to each flow feature extraction unit. In one embodiment, the at least one flow feature extraction unit includes a flow feature extraction unit corresponding to a link layer packet header, a flow feature extraction unit corresponding to an IPv4 header, and a flow feature extraction unit corresponding to a TCP header. For ease of description, the flow feature extraction unit corresponding to the link layer packet header is referred to as a link layer flow feature extraction unit, the flow feature extraction unit corresponding to the IPv4 header is referred to as an IPv4 flow feature extraction unit, and the flow feature extraction unit corresponding to the TCP header is referred to as a TCP flow feature extraction unit. The aforementioned at least one flow feature template includes a link-layer flow feature template, an IPv4 flow feature template, and a TCP flow feature template. The link-layer flow feature extraction unit corresponds to the link-layer flow feature template, the IPv4 flow feature extraction unit corresponds to the IPv4 flow feature template, and the TCP flow feature extraction unit corresponds to the TCP flow feature template. Taking a first packet including a link-layer header, an IPv4 header, and a TCP header as an example, the link-layer flow feature extraction unit is used to extract flow feature information from the link-layer header of the first packet according to the link-layer flow feature template. The IPv4 flow feature extraction unit is used to extract flow feature information from the IPv4 header of the first packet according to the IPv4 flow feature template; the TCP flow feature extraction unit is used to extract flow feature information from the TCP header of the first packet according to the TCP flow feature template. The implementation process of any flow feature extraction unit extracting flow feature information from the corresponding packet header according to the corresponding flow feature template can be referred to the implementation process of the packet forwarding device 120 extracting flow feature information from the corresponding packet header according to the corresponding flow feature template mentioned above, and will not be repeated here.
[0091] In one embodiment, please refer to Figure 6 The diagram illustrates a flow table matching module 121 provided in an embodiment of this application. The flow table matching module 121 includes N flow feature extraction units, which are connected in series (i.e., the N flow feature extraction units are connected sequentially), where N is an integer greater than 1. Figure 6Taking the N flow feature extraction units as flow feature extraction units 1 to N as an example for illustration. The first packet includes N packet headers, and the N packet headers correspond to the N flow feature extraction units one by one. Each of the N flow feature extraction units is used to extract flow feature information from the packet header corresponding to each flow feature extraction unit; the i-th flow feature extraction unit among the N flow feature extraction units is further used to: splice the flow feature information extracted by the i-th flow feature extraction unit from the packet header corresponding to the i-th flow feature extraction unit and the flow feature information output by the (i - 1)-th flow feature extraction unit, and output the spliced flow feature information, where 1 < i ≤ N and i is an integer. Among them, the flow feature information of the first packet is the flow feature information output by the N-th flow feature extraction unit.
[0092] In a specific embodiment, as Figure 6 shown, the 1st flow feature extraction unit among the N flow feature extraction units (for example, Figure 6 the flow feature extraction unit 1 in Figure 6 ) is used to: extract flow feature information from the packet header corresponding to the 1st flow feature extraction unit, and output the extracted flow feature information to the 2nd flow feature extraction unit among the N flow feature extraction units (for example, Figure 6 the flow feature extraction unit 2 in Figure 6The flow feature extraction unit N in the process outputs the concatenated flow feature information. That is, the first flow feature extraction unit among the N flow feature extraction units is used to: extract flow feature information from the packet header corresponding to the first flow feature extraction unit, and output the extracted flow feature information to the second flow feature extraction unit among the N flow feature extraction units. Each flow feature extraction unit other than the first flow feature extraction unit is used to: extract flow feature information from the packet header corresponding to each flow feature extraction unit, concatenate the flow feature information output by the preceding flow feature extraction unit and the flow feature information extracted from the corresponding packet header by each flow feature extraction unit, and output the concatenated flow feature information.
[0093] In another embodiment, please refer to Figure 7 The diagram illustrates another flow table matching module 121 provided in this application embodiment. The flow table matching module 121 includes a splicing unit 1211 and N flow feature extraction units connected in parallel. Each of the N flow feature extraction units is connected to the splicing unit 1211, and N is an integer greater than 1. Figure 7 Taking N flow feature extraction units as examples (flow feature extraction units 1 to N), the first message includes N message headers, each corresponding to one of the N flow feature extraction units. Each of the N flow feature extraction units is used to extract flow feature information from the message header corresponding to it and output the flow feature information to the splicing unit 1211. The splicing unit 1211 is used to splice the flow feature information extracted from the N message headers by the N flow feature extraction units to obtain the flow feature information of the first message.
[0094] It should be noted that the splicing rules of the flow feature extraction unit for splicing flow feature information, and the splicing rules of the splicing unit 1211 for splicing flow feature information, can be flexibly defined according to the actual situation. This application embodiment does not limit the splicing rules.
[0095] In an optional embodiment, the flow table matching module 121 further includes a parsing unit ( Figure 6 and Figure 7 (Not shown in the image), the parsing unit is connected to the aforementioned N flow feature extraction units respectively. The parsing unit is used to parse the first message to determine the aforementioned N message headers of the first message. Each of the N flow feature extraction units extracts flow feature information from the corresponding message header parsed by the parsing unit.
[0096] After obtaining the flow characteristic information of the first packet, the flow table matching module 121 determines the first flow forwarding table entry in the flow forwarding table based on the flow characteristic information of the first packet. In a specific embodiment, such as... Figure 6or Figure 7 As shown, the flow table matching module 121 includes a lookup unit 1212, which is used to: determine the first flow table entry in the flow table based on the flow characteristic information of the first message. For example, the lookup unit 1212 is used to search the flow table based on the flow characteristic information of the first message to determine the first flow table entry in the flow table.
[0097] In this embodiment, the maintenance of the flow table (e.g., adding, deleting, and updating flow table entries) can be performed by the pipeline processor 11. The data channel 12 can provide an interface to the pipeline processor 11 for maintaining the flow table, so that the pipeline processor 11 can maintain the flow table. In an optional embodiment, the first message belongs to the first flow, and the first flow table entry is a forwarding entry used to forward the first flow. The first flow table entry is generated by the pipeline processor 11. After generating the first flow table entry, the pipeline processor 11 sends the first flow table entry to the message forwarding device 120. The message forwarding device 120 is also used to receive the first flow table entry sent by the pipeline processor 11. After receiving the first flow table entry, the message forwarding device 120 stores the first flow table entry. For example, the message forwarding device 120 stores the first flow table entry in the memory of the NP chip 10. In an optional embodiment, the first flow table entry includes a mapping relationship between the flow characteristic information of the first message and the index information of the first control information. During the process of generating the first flow table entry, the pipeline processor 11 also generates the first control information and sends the first control information to the message forwarding device 120. The message forwarding device 120 is also used to receive the first control information sent by the pipeline processor 11. After receiving the first control information, the message forwarding device 120 stores the first control information. For example, the message forwarding device 120 stores the first control information in the memory of the NP chip 10.
[0098] In an optional embodiment, the first flow table entry is generated by the pipeline processor 11 based on the header of the second message received by the data channel 12, and the second message belongs to the first flow. The message forwarding device 120 is further configured to: obtain the flow characteristic information of the second message received by the data channel 12; determine that the flow characteristic information of the second message does not match the flow table, and send the header of the second message to the pipeline processor 11.
[0099] In a specific embodiment, after data channel 12 receives the second message, message forwarding device 120 obtains the flow characteristic information of the second message; message forwarding device 120 searches the flow table based on the flow characteristic information of the second message, and determines that there is no flow table entry matching the flow characteristic information of the second message, thereby determining that the flow characteristic information of the second message does not match the flow table; message forwarding device 120 sends the message header of the second message to pipeline processor 11. After receiving the message header of the second message, pipeline processor 11 generates a first flow table entry based on the message header of the second message, and sends the first flow table entry to message forwarding device 120. Message forwarding device 120 receives the first flow table entry and stores the first flow table entry. For example, the pipeline processor 11 generates a first flow table entry and first control information based on the header of the second message. The first flow table entry includes a mapping relationship between the flow characteristic information of the second message (both the second message and the first message belong to the first flow, and the flow characteristic information of the second message is the same as that of the first message) and the index information of the first control information. The pipeline processor 11 sends the first flow table entry and the first control information to the message forwarding device 120. The message forwarding device 120 receives the first flow table entry and the first control information, and stores the first flow table entry and the first control information.
[0100] In specific embodiments, such as Figure 5 As shown, the packet forwarding device 120 includes a flow table matching module 121 and a flow table data acquisition module 122, which are respectively connected to the pipeline processor 11. After the data channel 12 receives the second packet, the flow table matching module 121 acquires the flow characteristic information of the second packet. The flow table matching module 121 searches the flow table based on the flow characteristic information of the second packet and determines that there is no flow table entry matching the flow characteristic information of the second packet in the flow forwarding table. Therefore, it is determined that the flow characteristic information of the second packet does not match the flow table, and the flow table matching module 121 sends the packet header of the second packet to the pipeline processor 11. After the pipeline processor 11 generates the first flow table entry and the first control information, the pipeline processor 11 sends the first flow table entry to the flow table matching module 121 and sends the first control information to the flow table data acquisition module 122. Correspondingly, the flow table matching module 121 receives the first flow table entry sent by the pipeline processor 11 and stores the first flow table entry; the flow table data acquisition module 122 receives the first control information sent by the pipeline processor 11 and stores the first control information.
[0101] In a specific embodiment, after receiving the header of the second message, the pipeline processor 11 obtains the feature information carried in the header of the second message. Based on the feature information obtained from the header of the second message, the pipeline processor 11 performs full-service forwarding of the second message by looking up a series of service forwarding tables. Based on the feature information obtained from the header of the second message and the control information (including forwarding operation information, edit data, etc.) obtained by looking up the series of service forwarding tables using the feature information obtained from the header of the second message, the pipeline processor 11 generates a first forwarding table entry and first control information. For example, at least one header of the second message carries feature information including flow feature information; the pipeline processor 11 obtains the flow feature information of the second message based on the flow feature information obtained from the feature information obtained from the at least one header; the pipeline processor 11 obtains first control information based on control information obtained by searching the service forwarding table according to the feature information obtained from the at least one header; the pipeline processor 11 generates index information of the first control information; the pipeline processor 11 generates a first flow forwarding table entry based on the flow feature information of the second message and the index information of the first control information. In one embodiment, the at least one header is a single header, and the pipeline processor 11 determines the flow feature information of the second message from the feature information obtained from the single header as the flow feature information of the second message; the pipeline processor 11 determines the control information obtained by searching the service forwarding table according to the feature information obtained from the single header as the first control information. In another embodiment, the at least one message header is multiple message headers. The pipeline processor 11 concatenates the flow feature information obtained from the feature information obtained from the multiple message headers to obtain the flow feature information of the second message. The pipeline processor 11 concatenates the control information obtained by searching the service forwarding table based on the feature information obtained from the multiple message headers to obtain the first control information.
[0102] It should be noted that, as Figure 5 As shown, the pipeline processor 11 is also connected to the message processing module 123. During the process of performing full-service forwarding of the second message by looking up a series of service forwarding tables, the pipeline processor 11 can obtain control information. The pipeline processor 11 can send control information to the message processing module 123. The message processing module 123 performs forwarding processing on the second message according to the control information sent by the pipeline processor 11. For example, the message processing module 123 edits the second message according to the control information sent by the pipeline processor 11, and then sends the second message through its output port.
[0103] In an optional embodiment, the first stream is an elephant stream. The first stream has a large flow rate. In this embodiment, the pipeline processor 11 generates flow table entries for the elephant stream, which avoids generating flow table entries for smaller data streams, thus helping to reduce the size of the flow table.
[0104] In an optional embodiment, the first flow table entry is generated by the pipeline processor 11 when it determines that the number of first-order packets among the packets received by the data channel 12 reaches a preset number. Specifically, for each packet belonging to the first order received by the data channel 12: the packet forwarding device 120 searches the flow table based on the packet's flow characteristic information; if the flow characteristic information of the packet does not match the flow table, the packet forwarding device 120 sends the packet header to the pipeline processor 11. The pipeline processor 11 forwards the packet header, and during this forwarding process, it counts the number of first-order packets. When the number of first-order packets reaches a preset number, the pipeline processor 11 generates the first flow table entry. The aforementioned first message can be a message belonging to the first-order category received by the data channel 12 when the pipeline processor 11 determines that the number of messages belonging to the first-order category has reached a preset number (or thereafter). In this embodiment, the pipeline processor 11 generates a first flow table entry when the number of messages belonging to the first-order category among the messages received by the data channel 12 reaches a preset number. This avoids generating flow table entries for data streams with small traffic volumes and helps to reduce the size of the flow table.
[0105] It should be noted that, in this embodiment, the flow table is a key-value table, where the key is flow characteristic information and the value is the index information of control information. The flow characteristic information in the flow table includes flow characteristic information carried by the packet, and may also include flow characteristic information of the packet determined by other means, such as the source port (i.e., the ingress port) of the packet. Control information may include various possible control information used for packet forwarding. This includes, but is not limited to, control information for modifying packets, control information for telemetry of the data stream, and control information for ensuring the quality of service (QoS) of the data stream. Control information for telemetry of the data stream includes, for example, control information for counting packets in the data stream and control information for copying packets in the data stream. Control information used to ensure the QoS of data streams includes control information for dropping packets of a data stream, control information for passing packets of a data stream, control information for delaying packets of a data stream, and control information for scheduling packets of a data stream.
[0106] In summary, the technical solution provided in this application embodiment sets up a message forwarding device in the data channel of the NP chip, and the message forwarding device performs flow forwarding of messages. Compared with the pipeline processor in the NP chip performing message forwarding processing, the power consumption of the message forwarding device performing flow forwarding of messages is smaller (no need to perform a complete pipeline processing flow), which helps to reduce the power consumption of the NP chip.
[0107] The above is a description of the device embodiments of this application. The method embodiments of this application are described below.
[0108] Please refer to Figure 8 The diagram illustrates a flowchart of a message forwarding method provided in an embodiment of this application. This message forwarding method is applied to a message forwarding device in an NP chip, which includes a pipeline processor and a data channel, with the message forwarding device located in the data channel. For example, the NP chip is as follows: Figure 1 or Figure 5 As shown, the message forwarding device is message forwarding device 120.
[0109] See Figure 8 The message forwarding method includes the following steps S801 to S802.
[0110] S801. The message forwarding device acquires the flow characteristic information of the first message received by the data channel.
[0111] Here, the first message is any message received by the data channel. The flow characteristic information of the first message is the characteristic information of the data stream to which the first message belongs. The flow characteristic information of the first message is used to characterize the data stream to which the first message is sent. For example, if the first message belongs to the first stream, the flow characteristic information of the first message is the characteristic information of the first stream, and the flow characteristic information of the first message is used to characterize the first stream.
[0112] In optional embodiments, the first message carries flow characteristic information, and the flow characteristic information of the first message is determined based on the flow characteristic information carried in the first message. For example, the first message includes at least one message header, each of the at least one message header carrying flow characteristic information. The message forwarding device obtains the flow characteristic information carried in the at least one message header, and the message forwarding device obtains the flow characteristic information of the first message based on the flow characteristic information obtained from the at least one message header. In one embodiment, the at least one message header is a single message header, and the message forwarding device determines the flow characteristic information of the first message from the flow characteristic information obtained from the single message header. In another embodiment, the at least one message header is multiple message headers, and the message forwarding device concatenates the flow characteristic information obtained from the multiple message headers to obtain the flow characteristic information of the first message.
[0113] In an optional embodiment, the packet forwarding device includes at least one flow feature template, which corresponds one-to-one with the at least one packet header. The packet forwarding device obtains the flow feature information carried in each packet header based on the flow feature template corresponding to each packet header in the at least one packet header. For example, the packet forwarding device extracts flow feature information from each packet header based on the flow feature template corresponding to each packet header in the at least one packet header.
[0114] In an optional embodiment, the packet forwarding device includes a flow table matching module, which obtains flow feature information of a first packet. Specifically, in a specific embodiment, the first packet includes at least one packet header, and the flow table matching module obtains the flow feature information carried in the at least one packet header. The flow table matching module obtains the flow feature information of the first packet based on the flow feature information obtained from the at least one packet header. For example, the flow table matching module includes at least one flow feature extraction unit, which corresponds one-to-one with the at least one packet header. Each of the at least one flow feature extraction units extracts flow feature information from the corresponding packet header. In a specific embodiment, each of the at least one flow feature extraction unit corresponds one-to-one with at least one flow feature template, and each of the at least one flow feature extraction units extracts flow feature information from the packet header corresponding to each flow feature extraction unit according to the flow feature template corresponding to each flow feature extraction unit.
[0115] In one embodiment, the at least one flow feature extraction unit is N flow feature extraction units, and the N flow feature extraction units are connected in series. The at least one message header is N message headers, where N is an integer greater than 1. Each flow feature extraction unit among the N flow feature extraction units extracts flow feature information from the corresponding message header. The i-th flow feature extraction unit among the N flow feature extraction units splices the flow feature information extracted by the i-th flow feature extraction unit from the message header corresponding to the i-th flow feature extraction unit and the flow feature information output by the (i - 1)-th flow feature extraction unit, and outputs the spliced flow feature information, where 1 < i ≤ N and i is an integer. Among them, the flow feature information of the first message is the flow feature information output by the N-th flow feature extraction unit. In a specific embodiment, the first flow feature extraction unit among the N flow feature extraction units extracts flow feature information from the message header corresponding to the first flow feature extraction unit, and outputs the extracted flow feature information to the second flow feature extraction unit among the N flow feature extraction units. The second flow feature extraction unit extracts flow feature information from the message header corresponding to the second flow feature extraction unit, splices the flow feature information output by the first flow feature extraction unit to the second flow feature extraction unit and the flow feature information extracted by the second flow feature extraction unit from the message header corresponding to the second flow feature extraction unit, and outputs the spliced flow feature information to the third flow feature extraction unit among the N flow feature extraction units. The third flow feature extraction unit extracts flow feature information from the message header corresponding to the third flow feature extraction unit, splices the flow feature information output by the second flow feature extraction unit to the third flow feature extraction unit and the flow feature information extracted by the third flow feature extraction unit from the message header corresponding to the third flow feature extraction unit, and outputs the spliced flow feature information to the fourth flow feature extraction unit among the N flow feature extraction units. And so on, until the N-th flow feature extraction unit among the N flow feature extraction units outputs the spliced flow feature information.
[0116] In another embodiment, the at least one flow feature extraction unit is N flow feature extraction units, and the N flow feature extraction units are connected in parallel. The flow table matching module further includes a splicing unit, and the N flow feature extraction units are respectively connected to the splicing unit. Each flow feature extraction unit among the N flow feature extraction units extracts flow feature information from the corresponding message header, and outputs the flow feature information to the splicing unit. The splicing unit splices the flow feature information extracted by the N flow feature extraction units from the N message headers to obtain the flow feature information of the first message.
[0117] S802. The message forwarding device performs flow forwarding on the first message according to the flow feature information of the first message.
[0118] The message forwarding device determines a first flow forwarding table entry based on the flow characteristic information of the first message; the message forwarding device then performs flow forwarding on the first message based on the first flow forwarding table entry. Specifically, the first flow forwarding table entry matches the flow characteristic information of the first message. For example, the first flow forwarding table entry includes the flow characteristic information of the first message, ensuring a match between the first flow forwarding table entry and the flow characteristic information of the first message.
[0119] In an optional embodiment, the packet forwarding device obtains first control information based on a first flow forwarding table entry, and then performs flow forwarding on the first packet based on the first control information. In one embodiment, the first flow forwarding table entry includes a mapping relationship between flow characteristic information of the first packet and index information of the first control information. The packet forwarding device determines the index information of the first control information based on the first flow forwarding table entry, obtains the first control information based on the index information, and then performs flow forwarding on the first packet based on the first control information. For example, the first control information is stored in the memory of the NP chip. The packet forwarding device obtains the first control information from the memory of the NP chip based on the index information of the first control information, and then performs flow forwarding on the first packet based on the first control information.
[0120] In an optional embodiment, the packet forwarding device includes a flow table matching module, a flow table data acquisition module, and a packet processing module, which are connected sequentially. The flow table matching module acquires the flow characteristic information of a first packet. The flow table matching module determines a first flow forwarding entry in the flow forwarding table based on the flow characteristic information of the first packet. The flow table matching module determines the index information of first control information based on the first flow forwarding entry. The flow table data acquisition module acquires the first control information based on the index information of the first control information. The packet processing module performs flow forwarding on the first packet based on the first control information. In an optional embodiment, the flow table matching module includes a lookup unit; this lookup unit determines the first flow forwarding entry in the flow forwarding table based on the flow characteristic information of the first packet.
[0121] In an optional embodiment, the first message belongs to the first flow, and the first flow forwarding table entry is a forwarding table entry used for forwarding the first flow. This first flow forwarding table entry is generated by the pipeline processor. After generating the first flow forwarding table entry, the pipeline processor sends it to the message forwarding device. Correspondingly, the message forwarding device receives the first flow forwarding table entry sent by the pipeline processor. After receiving the first flow forwarding table entry, the message forwarding device stores it. Therefore, after a subsequent data channel receives the first message, the message forwarding device can determine the first flow forwarding table entry in the flow forwarding table based on the flow characteristic information of the first message.
[0122] In an optional embodiment, the first flow table entry is generated by the pipeline processor based on the header of the second message received by the data channel. The second message belongs to the first flow and precedes the first message. After the data channel receives the second message, the message forwarding device obtains the flow characteristic information of the second message. The message forwarding device searches the flow table based on the flow characteristic information of the second message. If it determines that the flow characteristic information of the second message does not match the flow table, the message forwarding device sends the header of the second message to the pipeline processor. After receiving the header of the second message, the pipeline processor generates the first flow table entry based on the header of the second message.
[0123] In an optional embodiment, the first stream is an "elephant stream." The first stream has a large flow rate. In this embodiment, the pipeline processor generates flow table entries for the elephant stream, which avoids generating flow table entries for smaller data streams, thus helping to reduce the size of the flow table.
[0124] In an optional embodiment, the first flow table entry is generated by the pipeline processor when it determines that the number of first-order packets among the packets received by the data channel reaches a preset number. Generating the first flow table entry when the number of first-order packets among the packets received by the data channel reaches the preset number helps reduce the size of the flow table.
[0125] For a detailed introduction to the message forwarding method, please refer to the aforementioned description of the message forwarding device embodiment; it will not be repeated here.
[0126] In summary, the technical solution provided in this application embodiment sets up a message forwarding device in the data channel of the NP chip, and the message forwarding device performs flow forwarding of messages. Compared with the pipeline processor in the NP chip performing message forwarding processing, the power consumption of the message forwarding device performing flow forwarding of messages is smaller (no need to perform a complete pipeline processing flow), which helps to reduce the power consumption of the NP chip.
[0127] Based on the same inventive concept, this application provides an NP chip, which includes a pipeline processor and a data channel. The data channel includes the packet forwarding device provided in the above embodiments. For example, the NP chip includes multiple packet processing engines, each packet processing engine including a pipeline processor and a data channel. The data channel in at least one packet processing engine includes the packet forwarding device provided in the above embodiments.
[0128] The NP chip may include programmable logic circuits and / or program instructions.
[0129] For example, the NP chip is like Figure 1 or Figure 5 As shown.
[0130] Based on the same inventive concept, embodiments of this application provide a network device including the aforementioned NP chip. This network device can be a switch, router, firewall, base station, or wireless local area network (WLAN) device. The base station can include 5G base stations, 6G base stations, etc. Furthermore, this network device is a high-bandwidth network device.
[0131] As an example, please refer to Figure 9 The diagram illustrates a network device 900 according to an embodiment of this application. The network device 900 includes a processor 902, a memory 904, an NP chip 906, a communication interface 908, and a bus 910. The processor 902, memory 904, NP chip 906, and communication interface 908 are communicatively connected via the bus 910. Figure 9 The connection method between the processor 902, memory 904, NP chip 906 and communication interface 908 shown is only an example. The processor 902, memory 904, NP chip 906 and communication interface 908 can also be connected in a way other than bus 910.
[0132] The memory 904 stores the computer program 9042, which may include instructions and data. The memory 904 can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), flash memory, optical storage, and registers.
[0133] The processor 902 can be a general-purpose processor, which performs specific steps and / or operations by reading and executing a computer program (e.g., computer program 9042) stored in memory (e.g., memory 904). The general-purpose processor may use data stored in memory (e.g., memory 904) during the execution of these steps and / or operations. The general-purpose processor can be a central processing unit (CPU). Alternatively, the processor 902 can be a special-purpose processor, which is specifically designed to perform specific steps and / or operations. A special-purpose processor can be a digital signal processor (DSP), an ASIC, or an FPGA, etc. The processor 902 can be a combination of multiple processors, such as a multi-core processor.
[0134] The NP chip 906, also known as a forwarding chip, network chip, or network forwarding chip, is primarily used for packet forwarding. In this embodiment, the NP chip 906 includes a pipeline processor and a data channel. This data channel includes the packet forwarding device provided in the above embodiments to perform flow forwarding of packets. The NP chip 906 can be the NP chip 10 described in the foregoing embodiments.
[0135] The communication interface 908 may include input / output (I / O) interfaces, physical interfaces, and logical interfaces for interconnecting devices within the network device 900, as well as interfaces for interconnecting the network device 900 with other devices. Physical interfaces may be POS interfaces, gigabit Ethernet (GE) interfaces, asynchronous transfer mode (ATM) interfaces, etc., used for interconnecting the network device 900 with other devices. Logical interfaces are internal interfaces of the network device 900, used for interconnecting devices within the network device 900. It is easy to understand that the communication interface 908 can be used for communication between the network device 900 and other devices; for example, the communication interface 908 is used for sending and receiving messages between the network device 900 and other devices.
[0136] Bus 910 can be of any type, used to interconnect processor 902, memory 904, NP chip 906, and communication interface 908. For example, bus 910 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. Bus 910 can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 9 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0137] The aforementioned devices in network device 900 can be disposed on separate chips, or at least partially or entirely on the same chip. Whether to dispose of the devices independently on different chips or integrate them on one or more chips often depends on the product design requirements. This application does not limit the specific implementation of the aforementioned devices.
[0138] Figure 9 The network device 900 shown is merely an example. In the implementation process, the network device 900 may also include other components, which will not be listed one by one in this article.
[0139] Based on the same inventive concept, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed (e.g., by a message forwarding device), performs the following... Figure 8 The illustrated method embodiment provides all or part of the steps of the message forwarding method.
[0140] Based on the same inventive concept, embodiments of this application provide a computer program product, which includes a program or code, which, when executed (e.g., executed by a message forwarding device), implements the following: Figure 8 The illustrated method embodiment provides all or part of the steps of the message forwarding method.
[0141] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented entirely or partially as a computer program product, which includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium, or a semiconductor medium (e.g., solid-state drive), etc.
[0142] It should be understood that the term "at least one" in this application refers to one or more, and "multiple" refers to two or more. The term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Furthermore, for clarity, this application uses terms such as "first," "second," and "third" to distinguish identical or similar items with substantially the same function and effect. Those skilled in the art will understand that the terms "first," "second," and "third" do not limit the quantity or order of execution.
[0143] The different types of embodiments, such as the method embodiments and device embodiments provided in this application, can be referenced to each other. The order of operations in the method embodiments can be adjusted appropriately, and the operations can be added or removed in response to the situation. Any variations that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the protection scope of this application, and therefore will not be described in detail.
[0144] In the corresponding embodiments provided in this application, it should be understood that the disclosed devices, etc., can be implemented through other configurations. For example, the device embodiments described above are merely illustrative. For instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed between devices or modules may be through some interfaces, or indirect coupling or communication connection between devices or modules, which may be electrical or other forms. Modules described as separate components may or may not be physically separate, and components described as modules may or may not be physical modules; they may be located in one place or distributed across multiple network nodes. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0145] The above description is merely an exemplary embodiment of this application, but the scope of protection of this application is not limited thereto. Any equivalent modifications or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A message forwarding device, characterized in that, Applied to a network processor NP chip, the NP chip includes a pipeline processor and a data channel, and the packet forwarding device is in the data channel. The packet forwarding device is used for: Obtain the flow feature information of the first packet received by the data channel; Perform flow forwarding on the first packet according to the flow feature information of the first packet.
2. The message forwarding device according to claim 1, characterized in that, The packet forwarding device is used for: Determine the first flow forwarding entry in the flow forwarding table according to the flow feature information of the first packet; Perform flow forwarding on the first packet according to the first flow forwarding entry.
3. The message forwarding device according to claim 2, characterized in that, The packet forwarding device is used for: Obtain the first control information according to the first flow forwarding entry; Perform flow forwarding on the first packet according to the first control information.
4. The message forwarding device according to claim 3, characterized in that, The first flow forwarding entry includes the mapping relationship between the flow feature information of the first packet and the index information of the first control information. The packet forwarding device is used for: Determine the index information of the first control information according to the first flow forwarding entry; Obtain the first control information according to the index information of the first control information.
5. The message forwarding device according to claim 4, characterized in that, The packet forwarding device includes a flow table matching module, a flow table data acquisition module and a packet processing module; The flow table matching module is used for: obtaining the flow feature information of the first packet; determining the first flow forwarding entry in the flow forwarding table according to the flow feature information of the first packet; determining the index information of the first control information according to the first flow forwarding entry; The flow table data acquisition module is used for: obtaining the first control information according to the index information of the first control information; The packet processing module is used for: performing flow forwarding on the first packet according to the first control information.
6. The message forwarding device according to claim 5, characterized in that, The flow table matching module is used for: Obtain the flow feature information carried by at least one packet header of the first packet; Obtain the flow feature information of the first packet based on the flow feature information obtained from the at least one packet header.
7. The message forwarding device according to claim 6, characterized in that, The flow table matching module includes at least one flow feature extraction unit, and the at least one flow feature extraction unit corresponds to the at least one packet header one by one; Each flow feature extraction unit in the at least one flow feature extraction unit is used for: extracting flow feature information from the corresponding packet header.
8. The message forwarding device according to claim 7, characterized in that, The at least one flow feature extraction unit is N flow feature extraction units, the N flow feature extraction units are connected in series, the at least one packet header is N packet headers, and N is an integer greater than 1; The i-th flow feature extraction unit in the N flow feature extraction units is further used for: splicing the flow feature information extracted by the i-th flow feature extraction unit from the corresponding packet header and the flow feature information output by the (i - 1)-th flow feature extraction unit, and outputting the spliced flow feature information, where 1 < i ≤ N and i is an integer; Wherein, the flow feature information of the first packet is the flow feature information output by the N-th flow feature extraction unit.
9. The message forwarding device according to claim 7, characterized in that, The at least one flow feature extraction unit is N flow feature extraction units, the N flow feature extraction units are connected in parallel, the at least one packet header is N packet headers, and N is an integer greater than 1; The flow table matching module further includes a splicing unit, which is used to splice the flow feature information extracted from the N packet headers by the N flow feature extraction units to obtain the flow feature information of the first packet.
10. The message forwarding apparatus according to any one of claims 5 to 9, characterized in that, The flow table matching module includes a lookup unit; the lookup unit is used to: determine the first flow table entry in the flow table based on the flow feature information of the first message.
11. The message forwarding apparatus according to any one of claims 2 to 10, characterized in that, The first message belongs to the first stream, and the first stream forwarding table entry is a forwarding table entry used to forward the first stream. The first stream forwarding table entry is generated by the pipeline processor. The message forwarding device is further configured to: receive the first stream forwarding table entry sent by the pipeline processor.
12. The message forwarding apparatus according to claim 11, characterized in that, The first stream is the elephant stream.
13. The message forwarding device according to claim 12, characterized in that, The first stream forwarding table entry is generated by the pipeline processor based on the header of the second message received by the data channel, and the second message belongs to the first stream; The message forwarding device is also used for: Obtain the flow characteristic information of the second message received by the data channel; If it is determined that the flow feature information of the second message does not match the flow table, the header of the second message is sent to the pipeline processor.
14. The message forwarding apparatus according to claim 12 or 13, characterized in that, The first stream forwarding table entry is generated by the pipeline processor when it determines that the number of packets belonging to the first stream among the packets received by the data channel reaches a preset number.
15. A message forwarding method, characterized in that, A packet forwarding device applied in a network processor NP chip, the NP chip including a pipeline processor and a data channel, the packet forwarding device being located in the data channel, the method comprising: The message forwarding device acquires the flow characteristic information of the first message received by the data channel; The message forwarding device performs flow forwarding on the first message based on the flow characteristic information of the first message.
16. The method according to claim 15, characterized in that, The message forwarding device performs flow forwarding on the first message based on the flow characteristic information of the first message, including: The message forwarding device determines the first flow forwarding table entry in the flow forwarding table based on the flow characteristic information of the first message; The message forwarding device performs flow forwarding on the first message according to the first flow table entry.
17. The method according to claim 16, characterized in that, The message forwarding device performs flow forwarding on the first message according to the first flow forwarding table entry, including: The message forwarding device obtains the first control information based on the first forwarding table entry; The message forwarding device performs flow forwarding of the first message according to the first control information.
18. The method according to claim 17, characterized in that, The first flow table entry includes the mapping relationship between the flow feature information of the first message and the index information of the first control information; The message forwarding device obtains first control information based on the first forwarding table entry, including: The message forwarding device determines the index information of the first control information based on the first forwarding table entry; The message forwarding device obtains the first control information based on the index information of the first control information.
19. The method according to claim 18, characterized in that, The packet forwarding device includes a flow table matching module, a flow table data acquisition module, and a packet processing module; The message forwarding device obtains the flow characteristic information of the first message received by the data channel, including: the flow table matching module obtains the flow characteristic information of the first message; The packet forwarding device determines a first forwarding entry in the forwarding table according to the flow feature information of the first packet, including: the flow table matching module determines the first forwarding entry in the forwarding table according to the flow feature information of the first packet; The packet forwarding device determines the index information of the first control information according to the first forwarding entry, including: the flow table matching module determines the index information of the first control information according to the first forwarding entry; The packet forwarding device obtains the first control information according to the index information of the first control information, including: the flow table data acquisition module obtains the first control information according to the index information of the first control information; The packet forwarding device performs flow forwarding on the first packet according to the first control information, including: the packet processing module performs flow forwarding on the first packet according to the first control information.
20. The method according to claim 19, characterized in that, The flow table matching module obtains the flow feature information of the first packet, including: The flow table matching module obtains the flow feature information carried by at least one packet header of the first packet; The flow table matching module obtains the flow feature information of the first packet based on the flow feature information obtained from the at least one packet header.
21. The method according to claim 20, characterized in that, The flow table matching module includes at least one flow feature extraction unit, and the at least one flow feature extraction unit corresponds to the at least one packet header one by one; The flow table matching module obtains the flow feature information carried by at least one packet header of the first packet, including: Each flow feature extraction unit in the at least one flow feature extraction unit extracts flow feature information from the corresponding packet header.
22. The method according to claim 21, characterized in that, The at least one flow feature extraction unit is N flow feature extraction units, the N flow feature extraction units are connected in series, the at least one packet header is N packet headers, and N is an integer greater than 1; The flow table matching module obtains the flow feature information of the first packet based on the flow feature information obtained from the at least one packet header, including: the i-th flow feature extraction unit in the N flow feature extraction units splices the flow feature information extracted by the i-th flow feature extraction unit from the corresponding packet header and the flow feature information output by the (i - 1)-th flow feature extraction unit, and outputs the spliced flow feature information, where 1 < i ≤ N and i is an integer; wherein, the flow feature information of the first packet is the flow feature information output by the N-th flow feature extraction unit.
23. The method according to claim 21, characterized in that, The at least one flow feature extraction unit is N flow feature extraction units, the N flow feature extraction units are connected in parallel, the at least one packet header is N packet headers, and N is an integer greater than 1; The flow table matching module further includes a splicing unit. The flow table matching module obtains the flow feature information of the first packet based on the flow feature information obtained from the at least one packet header, including: the splicing unit splices the flow feature information extracted by the N flow feature extraction units from the N packet headers to obtain the flow feature information of the first packet.
24. The method according to any one of claims 19 to 23, characterized in that, The flow table matching module includes a lookup unit; The flow table matching module determines the first flow table entry in the flow table based on the flow feature information of the first message, including: the lookup unit determines the first flow table entry in the flow table based on the flow feature information of the first message.
25. The method according to any one of claims 16 to 24, characterized in that, The first message belongs to the first stream, and the first stream forwarding table entry is a forwarding table entry used to forward the first stream. The first stream forwarding table entry is generated by the pipeline processor. The method further includes: the message forwarding device receiving the first stream forwarding table entry sent by the pipeline processor.
26. The method according to claim 25, characterized in that, The first stream is the elephant stream.
27. The method according to claim 16, characterized in that, The first stream forwarding table entry is generated by the pipeline processor based on the header of the second message received by the data channel, wherein the second message belongs to the first stream, and the method further includes: The message forwarding device acquires the flow characteristic information of the second message received by the data channel; The message forwarding device determines that the flow feature information of the second message does not match the flow forwarding table, and sends the message header of the second message to the pipeline processor.
28. The method according to claim 26 or 27, characterized in that, The first stream table entry is generated by the pipeline processor when it determines that the number of packets belonging to the first stream among the packets received by the data channel reaches a preset number.
29. A network processor NP chip, characterized in that, It includes a pipeline processor and a data channel, the data channel including a message forwarding device as described in any one of claims 1 to 14.
30. A network device, characterized in that, Includes the NP chip as described in claim 29.