Message hardware forwarding method and network equipment
By configuring the switching chip in the network device as a proxy mode and stacking the processor and switching chip ports in the processor and switching chip, the problem of heavy CPU burden in SRV6 technology is solved, and efficient hardware forwarding of packets is achieved.
Patent Information
- Application Number
- CN202510078729.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-17
- Publication Date
- 2025-05-02
- Estimated Expiration
- 2045-01-17
AI Technical Summary
In SRV6 technology, after the message is handed over to the CPU for processing, the CPU needs to look up the software table to determine the outgoing port and edit the message, which leads to a heavy burden on the CPU and affects the forwarding performance of the message.
By configuring the switch chip in the network device to proxy mode and configuring the ports of the processor and the switch chip in stack mode, the processor adds a stacking head to the original message, and the switch chip obtains the next hop information based on the stacking header search hardware table and edits the packet to be forwarded for forwarding.
This method effectively reduces the load of the processor, improves the performance of message forwarding, and realizes the hardware forwarding of messages.
Smart Images

Figure CN119922120A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data communication, and in particular to a message hardware forwarding method and network equipment. Background Art
[0002] Source routing is a network routing strategy that allows the sender of a data packet to specify the path that the data packet takes when it is transmitted in the network, including some or all of the routers along the way. This is different from traditional routing, in which each router in the network independently determines the next hop forwarding of the data packet based on its own routing table without caring about the ultimate source or destination of the data packet.
[0003] SRv6 (Segment Routing IPv6) is a segment routing network architecture implemented based on the IPv6 data plane. It is designed based on the source routing concept and supports inserting forwarding instructions at the head node to guide data packet forwarding.
[0004] The core idea of SR technology is to divide the message forwarding path into different segments and insert segment information into the message at the starting point of the path. The intermediate nodes only need to forward according to the segment information carried in the message, which is identified by SID (Segment Identifier).
[0005] Based on the SR technology of the IPv6 forwarding plane, SRH (Segment Routing Header) is added to the IPv6 routing extension header. The SRH is used to store the Segment List information of IPv6. Segment List is a forwarding path obtained by orderly arranging segments and network nodes. When forwarding a message, the SegmentsLeft and Segment List fields jointly determine the IPv6 destination address information, thereby guiding the forwarding path and behavior of the message.
[0006] In the current SRV6 technology, after a message is handed over to a CPU (Central Processing Unit) for processing, the CPU needs to look up a software table to determine the egress port for message forwarding and edit the message, which will cause a heavy burden on the CPU and affect the message forwarding performance. Summary of the invention
[0007] In view of this, an object of the present invention is to provide a message hardware forwarding method and a network device, which can reduce the processor load and improve the message forwarding performance.
[0008] In order to achieve the above purpose, the technical solution adopted by the embodiment of the present invention is as follows:
[0009] In a first aspect, the present invention provides a message hardware forwarding method, which is applied to a network device, wherein the network device includes a processor and a switching chip; the port of the switching chip connected to the processor is configured in a stacking mode, and the switching chip is configured in a proxy mode, and the method includes:
[0010] The processor adds a stack header to the original message to obtain a message to be forwarded;
[0011] After receiving the message to be forwarded, the switching chip searches the hardware table according to the stack head to obtain the next hop information;
[0012] The switching chip edits the message to be forwarded according to the next hop information and then forwards it.
[0013] In an optional implementation manner, the processor adds a stack header to the original message to obtain a message to be forwarded, including:
[0014] When the segment routing extension header SRH does not exist in the original message, or the SRH exists in the original message and the segment list in the SRH records the IP address of the local device and the number of remaining segments in the SRH is not 0, the processor adds a basic header and an egress editing extension header to the original message, fills the destination port in the basic header with a specified destination port and sets the number of extension headers to 1, sets the value of the next hop field in the egress editing extension header to a specified identifier, and obtains the message to be forwarded;
[0015] When the SRH exists in the original message and the segment list in the SRH records the IP address of the current device and the remaining number of segments in the SRH is 0, the processor adds the basic header to the original message, sets the destination port in the basic header to the proxy port and the number of extended headers to 0, and sets the input interface in the basic header to the designated input interface to obtain the message to be forwarded.
[0016] In an optional implementation, the hardware table includes a hardware routing table and a hardware next hop table; after the switching chip receives the message to be forwarded, searching the hardware table according to the stack head to obtain the next hop information, including:
[0017] When the destination port in the basic header is a proxy port, the switching chip determines the forwarding domain corresponding to the message to be forwarded according to the input interface in the basic header;
[0018] The switching chip searches the hardware routing table according to the forwarding domain corresponding to the message to be forwarded and the destination IP address of the message to be forwarded, and obtains the next hop identifier corresponding to the message to be forwarded;
[0019] The switching chip searches the hardware next hop table according to the next hop identifier corresponding to the message to be forwarded, and obtains the next hop information corresponding to the message to be forwarded.
[0020] In an optional implementation manner, the hardware table includes a hardware next hop table; after the switching chip receives the message to be forwarded, searching the hardware table according to the stack header to obtain next hop information, including:
[0021] When the destination port in the basic header is not a proxy port and the number of extended headers is 1, the switching chip obtains the designated identifier from the egress edit extended header;
[0022] The switching chip searches the hardware next hop table according to the designated identifier to obtain the next hop information corresponding to the message to be forwarded.
[0023] In an optional implementation manner, the switching chip edits the message to be forwarded according to the next hop information and then forwards the message, including:
[0024] The switching chip removes the stack header, and updates the source MAC address, destination MAC address and VLAN in the message to be forwarded to the source MAC address, destination MAC address and VLAN in the next hop information;
[0025] The switching chip forwards the edited message to be forwarded through the egress port in the next hop information.
[0026] In an optional embodiment, the method further comprises:
[0027] When there is no segment routing extension header SRH in the original message, the processor searches the software routing table according to the destination IP address of the original message to generate a new SRH, and adds the new SRH to the original message;
[0028] When the SRH exists in the original message and the segment list in the SRH records the IP address of the local device and the number of remaining segments in the SRH is not 0, the processor deletes the IP address of the local device from the segment list in the SRH, updates the number of remaining segments, and sets the next hop IP address in the segment list to the destination address of the IPV6 header;
[0029] When the SRH exists in the original message, the segment list in the SRH records the IP address of the local device, and the remaining number of segments in the SRH is 0, the processor deletes the SRH in the original message.
[0030] In a second aspect, the present invention provides a network device, comprising a processor and a switching chip, wherein a port of the switching chip connected to the processor is configured in a stacking mode, and the switching chip is configured in a proxy mode;
[0031] The processor is used to add a stack header to the original message to obtain a message to be forwarded;
[0032] The switching chip is used to search the hardware table according to the stack head to obtain the next hop information after receiving the message to be forwarded;
[0033] The switching chip is used to edit the message to be forwarded according to the next hop information and then forward it.
[0034] In an optional implementation, when the segment routing extension header SRH does not exist in the original message, or the SRH exists in the original message and the segment list in the SRH records the IP address of the local device and the remaining number of segments in the SRH is not 0, the processor is used to add a basic header and an egress editing extension header to the original message, fill the destination port in the basic header with a specified destination port and set the number of extension headers to 1, and set the value of the next hop field in the egress editing extension header to a specified identifier to obtain the message to be forwarded;
[0035] When the SRH exists in the original message and the segment list in the SRH records the IP address of the current device and the remaining number of segments in the SRH is 0, the processor is used to add the basic header to the original message, set the destination port in the basic header to the proxy port and the number of extended headers to 0, and set the input interface in the basic header to the designated input interface to obtain the message to be forwarded.
[0036] In an optional implementation, the hardware table includes a hardware routing table and a hardware next hop table;
[0037] When the destination port in the basic header is a proxy port, the switching chip is used to determine the forwarding domain corresponding to the message to be forwarded according to the input interface in the basic header;
[0038] The switching chip is used to search the hardware routing table according to the forwarding domain corresponding to the message to be forwarded and the destination IP address of the message to be forwarded, and obtain the next hop identifier corresponding to the message to be forwarded;
[0039] The switching chip is used to search the hardware next hop table according to the next hop identifier corresponding to the message to be forwarded, and obtain the next hop information corresponding to the message to be forwarded.
[0040] In an optional implementation, the hardware table includes a hardware next hop table;
[0041] When the destination port in the basic header is not a proxy port and the number of extended headers is 1, the switching chip is used to obtain the designated identifier from the egress edit extended header;
[0042] The switching chip is used to search the hardware next hop table according to the designated identifier to obtain the next hop information corresponding to the message to be forwarded.
[0043] Compared with the prior art, the message hardware forwarding method and network device provided in the embodiment of the present invention are applied to the network device, and the network device includes a processor and a switching chip. Configuring the switching chip to the proxy mode can effectively reduce the processor load. The port connecting the switching chip and the processor is configured to the stacking mode, and the processor is simulated as another switching chip. The processor adds a stacking header to the original message to obtain the message to be forwarded; after the switching chip receives the message to be forwarded, it searches the hardware table according to the stacking header to obtain the next hop information, and edits the message to be forwarded according to the next hop information and then forwards it, thereby realizing the hardware forwarding of the message, reducing the processor load, and improving the message forwarding performance.
[0044] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0046] Figure 1 A schematic flow chart of a message hardware forwarding method provided by an embodiment of the present invention is shown.
[0047] Figure 2 Another schematic flow chart of a method for forwarding messages by hardware provided in an embodiment of the present invention is shown.
[0048] Figure 3 Another schematic flow chart of a method for forwarding messages by hardware provided in an embodiment of the present invention is shown.
[0049] Figure 4 A block diagram of a network device provided by an embodiment of the present invention is shown.
[0050] Icon: 400-network device; 401-processor; 402-switch chip. DETAILED DESCRIPTION
[0051] The following will be combined with the accompanying drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.
[0052] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work are within the scope of protection of the present invention.
[0053] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0054] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0055] Please refer to Figure 1 , Figure 1 A flow chart of a message hardware forwarding method provided by an embodiment of the present invention is shown. The method is applied to a network device, the network device includes a processor and a switching chip; the port connected to the switching chip and the processor is configured in a stacking mode, and the switching chip is configured in a proxy mode. The method includes the following steps:
[0056] Step S10: The processor adds a stack header to the original message to obtain a message to be forwarded.
[0057] In the embodiment of the present invention, before implementing the hardware forwarding of the message, it is necessary to enable the proxy mode on the switching chip and create the next hop based on the business scenario. The processor generates a software routing table based on the next hop, sends the hardware routing table entry on the switching chip, specifies the next hop, and generates the hardware routing table.
[0058] After the port connecting the switch chip and the processor is configured in stacking mode, the processor is simulated as another switch chip. After the switch chip sends the received original message to the processor, the processor processes the original message and adds a stacking header to the processed message to obtain the message to be forwarded.
[0059] Step S20: After receiving the message to be forwarded, the switching chip searches the hardware table according to the stack header to obtain the next hop information.
[0060] The next hop information generally includes a source MAC address, a destination MAC address, a VLAN (Virtual Local Area Network) and an egress port.
[0061] Step S30: The switching chip edits the message to be forwarded according to the next hop information and then forwards it.
[0062] In the embodiment of the present invention, the switching chip parses the stack header from the message to be forwarded, searches the hardware table based on the fields in the stack header, obtains the next hop information corresponding to the message to be forwarded, and edits and forwards the message to be forwarded based on the next hop information.
[0063] In summary, the message hardware forwarding method provided by the embodiment of the present invention configures the switching chip into proxy mode, which can effectively reduce the processor load. The port connecting the switching chip and the processor is configured into stacking mode, and the processor is simulated as another switching chip. The processor adds a stacking header to the original message to obtain the message to be forwarded; after the switching chip receives the message to be forwarded, it searches the hardware table according to the stacking header to obtain the next hop information, and edits the message to be forwarded according to the next hop information and then forwards it, thereby realizing the hardware forwarding of the message, reducing the processor load, and improving the message forwarding performance.
[0064] Optionally, the following provides a possible implementation method for generating a message to be forwarded based on the original message. Figure 2 , Figure 1 The sub-steps of step S10 may include:
[0065] Step S104, when there is no segment routing extension header SRH in the original message, or there is SRH in the original message and the segment list in the SRH records the IP address of the current device and the remaining number of segments in the SRH is not 0, the processor adds a basic header and an export editing extension header to the original message, fills the destination port in the basic header with the specified destination port and sets the number of extension headers to 1, sets the value of the next hop field in the export editing extension header to the specified identifier, and obtains the message to be forwarded.
[0066] In the embodiment of the present invention, after receiving the original message, the processor parses the original message to obtain the SRH. If the original message received by the device does not contain the SRH, it means that the device is the head node in the forwarding path of the original message, and the processor searches the software routing table to obtain the specified next hop, and uses the specified next hop identifier as the specified identifier.
[0067] If the original message contains SRH, the processor reads the segment list (i.e., the Segment List field) and the number of remaining segments (i.e., the SL (Segments Left) field) from the SRH. The processor obtains the IP address of the device and determines whether the IP address of the device is recorded in the segment list. If the IP address of the device is recorded in the segment list and the number of remaining segments is not 0, it indicates that the device is an intermediate node in the forwarding path of the original message. The processor searches the software routing table to obtain the specified next hop and uses the specified next hop identifier as the specified identifier.
[0068] The processor creates a basic header and an egress edit extension header, fills the destination port in the basic header with the specified destination port and sets the number of extension headers to 1, and sets the next hop field in the egress edit extension header to the specified identifier. The processor combines the basic header and the egress edit extension header into a stacking header, and uses the stacking header to encapsulate the processed message to obtain a message to be forwarded. The processor sends the message to be forwarded to the switching chip. The specified destination port in this step can be any panel port.
[0069] Step S105, when there is SRH in the original message and the segment list in the SRH records the IP address of this device and the remaining number of segments in the SRH is 0, the processor adds a basic header to the original message, sets the destination port in the basic header to the proxy port and the number of extended headers to 0, sets the input interface in the basic header to the specified input interface, and obtains the message to be forwarded.
[0070] In an embodiment of the present invention, if there is an SRH in the original message, the processor obtains the segment list and the remaining number of segments from the SRH. If the IP address of the current device is recorded in the segment list and the remaining number of segments is 0, it means that the current device is the terminal node in the forwarding path of the original message. The processor searches the software routing table according to the destination IP address of the original message to obtain the designated input interface corresponding to the original message.
[0071] The processor creates a basic header in the stack header, sets the value of the destination port field in the basic header to the proxy port (e.g., 0xFE), sets the number of extended headers to 0, and sets the value of the input interface field in the basic header to the specified input interface (e.g., the specified input interface ID). The processor uses the stack header to encapsulate the processed message to obtain the message to be forwarded. The processor sends the message to be forwarded to the switching chip.
[0072] It is worth mentioning that the embodiment of the present invention applies the proxy mode of the switching chip to the SRv6 scenario, which can meet various requirements of message forwarding in the SRv6 scenario. The switching chip can use the specified identifier to search the hardware next hop table to implement message hardware forwarding, or use the specified input interface to search the hardware routing table and the hardware next hop table to implement message hardware forwarding, which can effectively reduce the business load of the processor and reduce the message forwarding delay.
[0073] Optionally, the hardware table includes a hardware routing table and a hardware next hop table. As to how to obtain the next hop information by using the hardware routing table and the hardware next hop table, a possible implementation manner is provided below.
[0074] Please refer to Figure 2 , Figure 1 The sub-steps of step S20 may include:
[0075] Step S201: When the destination port in the basic header is a proxy port, the switching chip determines the forwarding domain corresponding to the message to be forwarded according to the input interface in the basic header.
[0076] In the embodiment of the present invention, when the processor adds a basic header to the original message, the number of extended headers in the basic header defaults to 0. When specifying the identifier of the next hop, the processor sets the number of extended headers to 1.
[0077] After the switching chip receives the message to be forwarded, it parses the message to be forwarded to obtain the basic header. When the switching chip determines that the number of extended headers in the basic header is 0 and the value of the destination port field in the basic header is the proxy port (for example, 0xFE), it means that it is necessary to obtain the next hop information corresponding to the message to be forwarded by searching the hardware routing table. The switching chip reads the value of the input interface field from the basic header to obtain the specified interface, and obtains the corresponding forwarding domain according to the specified interface.
[0078] Step S202: The switching chip searches the hardware routing table according to the forwarding domain corresponding to the message to be forwarded and the destination IP address of the message to be forwarded, and obtains the next hop identifier corresponding to the message to be forwarded.
[0079] In the embodiment of the present invention, a hardware routing table is recorded on the switching chip, and the hardware routing table records multiple routing table items, each of which includes a forwarding domain, a destination IP address, and a next hop identifier. The switching chip searches the hardware routing table for a matching routing table item based on the forwarding domain corresponding to the message to be forwarded and the destination IP address of the message to be forwarded, and takes out the next hop identifier corresponding to the message to be forwarded from the matching routing table item.
[0080] Step S203: The switching chip searches the hardware next hop table according to the next hop identifier corresponding to the message to be forwarded, and obtains the next hop information corresponding to the message to be forwarded.
[0081] In the embodiment of the present invention, the switching chip also records a hardware next hop table, which records multiple next hop entries, and the next hop entries are used to record next hop information. When a new next hop is created, the next hop entry corresponding to the new next hop is added to the hardware next hop table.
[0082] The switching chip searches the hardware next hop table according to the next hop identifier corresponding to the message to be forwarded, obtains the corresponding next hop table entry, and reads the next hop information corresponding to the next hop identifier from the matching next hop table entry to obtain the next hop information corresponding to the message to be forwarded.
[0083] It can be seen that the embodiment of the present invention uses the switching chip to search the hardware routing table and the hardware next hop table to quickly obtain the next hop information, which effectively reduces the load of the processor and can improve the performance of message forwarding.
[0084] Optionally, the following provides a possible implementation method for how to use the hardware next hop table to obtain the next hop information. Figure 2 , Figure 1 The sub-steps of step S20 may include:
[0085] Step S204: When the destination port in the basic header is not a proxy port and the number of extended headers is 1, the switching chip obtains a designated identifier from the egress edited extended header.
[0086] Step S205: The switching chip searches the hardware next hop table according to the specified identifier to obtain the next hop information corresponding to the message to be forwarded.
[0087] In an embodiment of the present invention, when the switching chip receives a message to be forwarded, it parses the message to be forwarded to obtain a basic header, and the switching chip determines whether the destination port in the basic header is a proxy port and whether the number of extension headers is 1. If the destination port is not a proxy port and the number of extension headers is 1, the switching chip parses the message to be forwarded to obtain an export editing extension header, and reads the value of the next hop field from the export editing extension header to obtain a specified identifier.
[0088] The switching chip searches the hardware next hop table based on the specified identifier, obtains the next hop table entry of the specified identifier, and reads the next hop information corresponding to the specified identifier from the next hop table entry, thereby quickly obtaining the next hop information corresponding to the message to be forwarded, effectively improving the performance of message forwarding.
[0089] Optionally, the following provides a possible implementation method for how to use the next hop information to forward the message to be forwarded. Figure 2 , Figure 1 The sub-steps of step S30 may include:
[0090] Step S301: The switching chip removes the stack header and updates the source MAC address, destination MAC address and VLAN in the message to be forwarded to the source MAC address, destination MAC address and VLAN in the next hop information.
[0091] Step S302: The switching chip forwards the edited message to be forwarded through the egress port in the next hop information.
[0092] In the embodiment of the present invention, after the switching chip obtains the next hop information corresponding to the message to be forwarded, it starts to edit the message to be forwarded. The switching chip removes the stack header in the message to be forwarded, updates the source MAC address in the message to be forwarded to the source MAC address in the next hop information, updates the destination MAC address in the message to be forwarded to the destination MAC address in the next hop information, updates the VLAN in the message to be forwarded to the VLAN in the next hop information, and finally forwards the edited message to be forwarded through the egress port in the next hop information to realize segmented routing forwarding.
[0093] Optionally, see Figure 3 ,exist Figure 2 Before step S104, the message hardware forwarding method further includes the following steps:
[0094] Step S101: When there is no segment routing extension header SRH in the original message, the processor searches the software routing table according to the destination IP address of the original message to generate a new SRH, and adds the new SRH to the original message.
[0095] In the embodiment of the present invention, if the original message received by the device does not contain SRH, it means that the device is the head node in the forwarding path of the original message. The head node encapsulates the SRv6 path information in the SRH through the processor, and the processor obtains the SRv6 path information of the original message according to the software routing table to generate the SRH, and adds the newly generated SRH to the original message.
[0096] Step S102, when there is SRH in the original message and the segment list in the SRH records the IP address of this device and the remaining number of segments in the SRH is not 0, the processor deletes the IP address of this device from the segment list in the SRH, updates the remaining number of segments, and sets the next hop IP address in the segment list as the destination address of the IPV6 header.
[0097] In an embodiment of the present invention, if the original message received by the device contains an SRH, the segment list and the number of remaining segments are read from the SRH. If the IP address of the device is recorded in the segment list and the number of remaining segments is greater than 0, it indicates that the device is an intermediate node in the forwarding path of the original message. The processor deletes the IP address of the device from the segment list, copies the last IP address in the segment list (i.e., the next-hop IP address) to the destination address field in the IPv6 header, and reduces the number of remaining segments by 1.
[0098] Step S103: When the SRH exists in the original message and the segment list in the SRH records the IP address of the local device and the number of remaining segments in the SRH is 0, the processor deletes the SRH in the original message.
[0099] In the embodiment of the present invention, if the original message received by the device contains SRH, the segment list and the number of remaining segments are read from the SRH. If the IP address of the device is recorded in the segment list and the number of remaining segments is 0, it means that the device is the terminal node in the forwarding path of the original message. In order to ensure the security, efficiency and correct processing of the network, the SRH in the original message of SRv6 needs to be removed after the original message reaches the terminal node.
[0100] In order to more clearly illustrate the message hardware forwarding method provided by the embodiment of the present invention, the following example is used for illustration.
[0101] Assume that the hardware next hop table records the next hop information of nexthop1 and nexthop2. The next hop information of nexthop1 includes: source MAC address 1.1.1, destination MAC address 2.2.2, VLAN 100, and egress port 1. The next hop information of Nexthop2 includes: source MAC address 3.3.3, destination MAC address 4.4.4, VLAN 200, and egress port 2. The interface ID of the routing port of the network device is 1, and the forwarding domain is 0. The hardware routing table records the forwarding domain as 0, the destination IP address as 2024:88, and the next hop identifier as nexthop1.
[0102] As a possible implementation method, the switching chip sends the original message to the processor. When the SRH exists in the original message and the IP address of the current device is recorded in the segment list in the SRH and the remaining number of segments in the SRH is 0, the processor deletes the SRH from the original message, adds a basic header to the original message, sets the value of the destination port field in the basic header to the proxy port (for example, 0xFE), and sets the value of the input interface field in the basic header (for example, srcVlanPtr) to 4097, that is, 4096+1 (1 is the interface ID of the routing port of the network device), obtains the message to be forwarded, and sends the message to be forwarded to the switching chip.
[0103] After receiving the message to be forwarded, the switching chip parses the message to be forwarded to obtain the basic header, and based on the fact that the number of extended headers in the basic header is 0 and the value of the destination port is the proxy port (for example, 0xFE), determines that it is necessary to obtain the next hop identifier corresponding to the message to be forwarded by searching the hardware routing table.
[0104] The switching chip obtains the interface ID of the routing port as 1 according to the value of the input interface field (4097) in the basic header, and obtains the forwarding domain (0) according to the interface ID of the routing port. Assuming that the destination IP address of the message to be forwarded is 2024:88, the switching chip searches the hardware routing table according to the forwarding domain (0) and the destination IP address of the message to be forwarded (2024:88), and obtains the next hop identifier nexthop1. The switching chip searches the hardware next hop table according to nexthop1, obtains the next hop information corresponding to nexthop1, and updates the source MAC address of the message to be forwarded to 1.1.1, the destination MAC address to 2.2.2, and the VLAN to 100 based on the next hop information, and forwards the edited message to be forwarded through port 1.
[0105] As another possible implementation, the switching chip sends the original message to the processor, and when the SRH does not exist in the original message, the processor adds the SRH to the original message according to the software routing table. When the SRH exists in the original message and the IP address of the device is recorded in the segment list in the SRH and the number of remaining segments in the SRH is not 0, the processor updates the SRH in the original message.
[0106] Assuming that the next hop identifier corresponding to the original message is nexthop2, the processor adds a basic header and an export edit extension header to the updated message, fills the destination port in the basic header with the specified port and sets the number of extension headers to 1, sets the value of the next hop field (for example, nexthopPtr) in the export edit extension header to nexthop2, obtains the message to be forwarded, and sends the message to be forwarded to the switching chip.
[0107] After receiving the message to be forwarded, the switching chip parses the message to be forwarded to obtain the basic header, and determines whether the destination port is a proxy port and whether the number of extended headers is 1. If the destination port is not a proxy port and the number of extended headers is 1, it is determined that there is no need to search the hardware routing table, and the next hop information corresponding to the message to be forwarded is directly obtained by searching the hardware next hop table.
[0108] The switching chip searches the hardware next hop table according to nexthop2, obtains the next hop information corresponding to nexthop2, updates the source MAC address of the message to be forwarded to 3.3.3, the destination MAC address to 4.4.4, and the VLAN to 200 based on the next hop information, and forwards the edited message to be forwarded through port 2.
[0109] Please refer to Figure 4 , Figure 4 A block diagram of a network device 400 is provided for an embodiment of the present invention. The network device 400 includes a processor 401 and a switch chip 402; the port of the switch chip 402 connected to the processor 401 is configured in a stacking mode, and the switch chip 402 is configured in a proxy mode.
[0110] The processor 401 is configured to add a stack header to the original message to obtain a message to be forwarded.
[0111] The switching chip 402 is used to search the hardware table according to the stack header to obtain the next hop information after receiving the message to be forwarded.
[0112] The switching chip 402 is used to edit the message to be forwarded according to the next hop information and then forward it.
[0113] In summary, the network device provided in the embodiment of the present invention includes a processor and a switching chip. Configuring the switching chip to proxy mode can effectively reduce the processor load. The port connecting the switching chip to the processor is configured to stacking mode, and the processor is simulated as another switching chip. The processor adds a stacking header to the original message to obtain the message to be forwarded; the switching chip searches the hardware table according to the stacking header to obtain the next hop information, and edits the message to be forwarded according to the next hop information and then forwards it, thereby realizing hardware forwarding of the message, reducing the processor load, and improving the message forwarding performance.
[0114] Optionally, when the segment routing extension header SRH does not exist in the original message, or when the SRH exists in the original message and the segment list in the SRH records the IP address of the current device and the remaining number of segments in the SRH is not 0, the processor 401 is used to add a basic header and an export editing extension header to the original message, fill the destination port in the basic header with the specified destination port and set the number of extension headers to 1, and set the value of the next hop field in the export editing extension header to the specified identifier to obtain a message to be forwarded.
[0115] When SRH exists in the original message and the segment list in the SRH records the IP address of this device and the remaining number of segments in the SRH is 0, the processor 401 is used to add a basic header to the original message, and set the destination port in the basic header to the proxy port and the number of extended headers to 0, and set the input interface in the basic header to the specified input interface to obtain the message to be forwarded.
[0116] Optionally, the hardware table includes a hardware routing table and a hardware next hop table; when the number of extended headers in the basic header is 0 and the destination port in the basic header is a proxy port, the switching chip 402 is used to determine the forwarding domain corresponding to the message to be forwarded according to the input interface in the basic header.
[0117] The switching chip 402 is used to search the hardware routing table according to the forwarding domain corresponding to the message to be forwarded and the destination IP address of the message to be forwarded, and obtain the next hop identifier corresponding to the message to be forwarded.
[0118] The switching chip 402 is used to search the hardware next hop table according to the next hop identifier corresponding to the message to be forwarded, and obtain the next hop information corresponding to the message to be forwarded. The next hop information includes the source MAC address, the destination MAC address, the VLAN and the egress port.
[0119] Optionally, the hardware table includes a hardware next hop table; when the destination port in the basic header is not a proxy port and the number of extended headers is 1, the switching chip 402 is used to obtain a specified identifier from the egress edited extended header;
[0120] The switching chip 402 is used to search the hardware next hop table according to the specified identifier to obtain the next hop information corresponding to the message to be forwarded.
[0121] Optionally, the switching chip 402 is used to remove the stack header, and update the source MAC address, destination MAC address and VLAN in the message to be forwarded to the source MAC address, destination MAC address and VLAN in the next hop information.
[0122] The switching chip 402 is used to forward the edited message to be forwarded through the egress port in the next hop information.
[0123] Optionally, when the segment routing extension header SRH does not exist in the original message, the processor 401 is configured to search the software routing table according to the destination IP address of the original message to generate a new SRH, and add the new SRH to the original message.
[0124] When SRH exists in the original message and the segment list in the SRH records the IP address of the current device and the remaining number of segments in the SRH is not 0, the processor 401 is used to delete the IP address of the current device from the segment list in the SRH, update the remaining number of segments, and set the next hop IP address in the segment list to the destination address of the IPV6 header.
[0125] When the SRH exists in the original message, the IP address of the local device is recorded in the segment list of the SRH, and the number of remaining segments is 0, the processor 401 is configured to delete the SRH in the original message.
[0126] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0127] In addition, the functional modules in the various embodiments of the present invention may be integrated together to form an independent part, or each module may exist independently, or two or more modules may be integrated to form an independent part.
[0128] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A message hardware forwarding method, characterized in that: Applied to a network device, the network device includes a processor and a switching chip; the port of the switching chip connected to the processor is configured in a stacking mode, and the switching chip is configured in a proxy mode, the method includes: The processor adds a stack header to the original message to obtain a message to be forwarded; After receiving the message to be forwarded, the switching chip searches the hardware table according to the stack head to obtain the next hop information; The switching chip edits the message to be forwarded according to the next hop information and then forwards it.
2. The message hardware forwarding method according to claim 1, characterized in that: The processor adds a stack header to the original message to obtain a message to be forwarded, including: When the segment routing extension header SRH does not exist in the original message, or the SRH exists in the original message and the segment list in the SRH records the IP address of the local device and the number of remaining segments in the SRH is not 0, the processor adds a basic header and an egress editing extension header to the original message, fills the destination port in the basic header with a specified destination port and sets the number of extension headers to 1, sets the value of the next hop field in the egress editing extension header to a specified identifier, and obtains the message to be forwarded; When the SRH exists in the original message and the segment list in the SRH records the IP address of the current device and the remaining number of segments in the SRH is 0, the processor adds the basic header to the original message, sets the destination port in the basic header to the proxy port and the number of extended headers to 0, and sets the input interface in the basic header to the designated input interface to obtain the message to be forwarded.
3. The message hardware forwarding method according to claim 2, characterized in that: The hardware table includes a hardware routing table and a hardware next hop table; After receiving the message to be forwarded, the switching chip searches the hardware table according to the stack header to obtain next hop information, including: When the destination port in the basic header is a proxy port, the switching chip determines the forwarding domain corresponding to the message to be forwarded according to the input interface in the basic header; The switching chip searches the hardware routing table according to the forwarding domain corresponding to the message to be forwarded and the destination IP address of the message to be forwarded, and obtains the next hop identifier corresponding to the message to be forwarded; The switching chip searches the hardware next hop table according to the next hop identifier corresponding to the message to be forwarded, and obtains the next hop information corresponding to the message to be forwarded.
4. The message hardware forwarding method according to claim 2, characterized in that: The hardware table includes a hardware next hop table; After receiving the message to be forwarded, the switching chip searches the hardware table according to the stack header to obtain next hop information, including: When the destination port in the basic header is not a proxy port and the number of extended headers is 1, the switching chip obtains the designated identifier from the egress edit extended header; The switching chip searches the hardware next hop table according to the designated identifier to obtain the next hop information corresponding to the message to be forwarded.
5. The message hardware forwarding method according to claim 1, characterized in that: The switching chip edits the message to be forwarded according to the next hop information and then forwards the message, including: The switching chip removes the stack header, and updates the source MAC address, destination MAC address and VLAN in the message to be forwarded to the source MAC address, destination MAC address and VLAN in the next hop information; The switching chip forwards the edited message to be forwarded through the egress port in the next hop information.
6. The message hardware forwarding method according to claim 1, characterized in that: The method further comprises: When there is no segment routing extension header SRH in the original message, the processor searches the software routing table according to the destination IP address of the original message to generate a new SRH, and adds the new SRH to the original message; When the SRH exists in the original message and the segment list in the SRH records the IP address of the local device and the number of remaining segments in the SRH is not 0, the processor deletes the IP address of the local device from the segment list in the SRH, updates the number of remaining segments, and sets the next hop IP address in the segment list to the destination address of the IPV6 header; When the SRH exists in the original message, the segment list in the SRH records the IP address of the local device, and the remaining number of segments in the SRH is 0, the processor deletes the SRH in the original message.
7. A network device, characterized in that: It includes a processor and a switching chip, wherein the port of the switching chip connected to the processor is configured in a stacking mode, and the switching chip is configured in a proxy mode; The processor is used to add a stack header to the original message to obtain a message to be forwarded; The switching chip is used to search the hardware table according to the stack head to obtain the next hop information after receiving the message to be forwarded; The switching chip is used to edit the message to be forwarded according to the next hop information and then forward it.
8. The network device according to claim 7, characterized in that: When the segment routing extension header SRH does not exist in the original message, or the SRH exists in the original message and the segment list in the SRH records the IP address of the local device and the number of remaining segments in the SRH is not 0, the processor is used to add a basic header and an egress editing extension header to the original message, fill the destination port in the basic header with a specified destination port and set the number of extension headers to 1, and set the value of the next hop field in the egress editing extension header to a specified identifier to obtain the message to be forwarded; When the SRH exists in the original message and the segment list in the SRH records the IP address of the current device and the remaining number of segments in the SRH is 0, the processor is used to add the basic header to the original message, set the destination port in the basic header to the proxy port and the number of extended headers to 0, and set the input interface in the basic header to the designated input interface to obtain the message to be forwarded.
9. The network device according to claim 8, characterized in that: The hardware table includes a hardware routing table and a hardware next hop table; When the destination port in the basic header is a proxy port, the switching chip is used to determine the forwarding domain corresponding to the message to be forwarded according to the input interface in the basic header; The switching chip is used to search the hardware routing table according to the forwarding domain corresponding to the message to be forwarded and the destination IP address of the message to be forwarded, and obtain the next hop identifier corresponding to the message to be forwarded; The switching chip is used to search the hardware next hop table according to the next hop identifier corresponding to the message to be forwarded, and obtain the next hop information corresponding to the message to be forwarded.
10. The network device according to claim 8, characterized in that: The hardware table includes a hardware next hop table; When the destination port in the basic header is not a proxy port and the number of extended headers is 1, the switching chip is used to obtain the designated identifier from the egress edit extended header; The switching chip is used to search the hardware next hop table according to the designated identifier to obtain the next hop information corresponding to the message to be forwarded.
Citation Information
Patent Citations
Interchanger stacking system, slave unit, switching chip and method for processing protocol message
CN106685826A
Cross-network slice segment routing forwarding method and device
CN110266594A
Virtual stacking of switches
US20150085704A1
Time delay measurement method and apparatus based on srv6 sid
WO2022117092A1