WO2023088226A1 - 转发报文的方法以及相关设备 - Google Patents

转发报文的方法以及相关设备 Download PDF

Info

Publication number
WO2023088226A1
WO2023088226A1 PCT/CN2022/131859 CN2022131859W WO2023088226A1 WO 2023088226 A1 WO2023088226 A1 WO 2023088226A1 CN 2022131859 W CN2022131859 W CN 2022131859W WO 2023088226 A1 WO2023088226 A1 WO 2023088226A1
Authority
WO
WIPO (PCT)
Prior art keywords
prefix
processing node
target
message
routing table
Prior art date
Application number
PCT/CN2022/131859
Other languages
English (en)
French (fr)
Inventor
陈志赛
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2023088226A1 publication Critical patent/WO2023088226A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/54Organization of routing tables
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • H04L45/748Address table lookup; Address filtering using longest matching prefix

Definitions

  • the present application relates to the technical field of forwarding equipment, in particular to a method for forwarding messages and related equipment.
  • Forwarding devices such as routers and switches can forward received packets.
  • forwarding volume of forwarding devices is increasing, and the corresponding storage requirements for routing tables are also increasing, resulting in storage pressure and routing query pressure on hardware such as forwarding chips that provide forwarding functions in forwarding devices. Larger, often cannot meet the needs of the application scenario, thus affecting the forwarding performance of the forwarding device.
  • the embodiment of the present application provides a method for forwarding messages, which is used to solve the problem that the forwarding volume of the current forwarding device is increasing, and the storage demand corresponding to the routing table is also increasing, resulting in the forwarding chip that provides the forwarding function in the forwarding device
  • the storage pressure of hardware and other hardware and the pressure of routing query are relatively high, which often cannot meet the needs of application scenarios.
  • Embodiments of the present application also provide corresponding devices, computer equipment, computer-readable storage media, computer program products, and the like.
  • the first aspect of the present application provides a method for forwarding a message, the method is applied to a first processing node in a forwarding device, and the forwarding device further includes a second processing node, and the method includes: receiving a message sent by the second processing node information, the message does not match the corresponding target output port in the hotspot routing table stored in the second processing node; according to the global routing table stored in the first processing node, determine the target output port corresponding to the message, so that the forwarding device passes the target The outgoing port forwards the packet.
  • the forwarding device may be a switch (switch), a router (router) or a gateway device.
  • the first processing node and the second processing node may be different physical modules in the forwarding device, or may be different virtual machines or different containers in the forwarding device.
  • the routing table is used to find the corresponding outgoing port in the forwarding device according to the destination IP address of the message.
  • the routing table may include a hotspot routing table and a global routing table.
  • the hotspot routing table may include, but is not limited to, information about egress ports that are used more frequently by the forwarding device when forwarding packets within a certain period of time.
  • the global routing table may include relevant information of all outgoing ports corresponding to packet forwarding by the forwarding device.
  • the specific information contained in the routing table and the method for determining the destination egress port corresponding to the message may be determined based on the principle adopted by the forwarding device for routing lookup based on the routing table.
  • the principle adopted for routing lookup based on the routing table may be a longest prefix match (longest prefix match, LPM) principle.
  • the second processing node matches the target output port corresponding to the received message according to the hotspot routing table, so that the second processing node can use the hotspot routing information to efficiently route queries. If the target outbound port corresponding to the message is not matched in the hotspot routing table stored by the second processing node, the second processing node sends the message to the first processing node, so that the first processing node can The global routing table determines the target output port corresponding to the message, so that the forwarding device forwards the message through the target output port. In this way, the storage resources and data processing resources of the first processing node can be reasonably utilized to match non-hot route information, so as to improve the forwarding performance of the forwarding device.
  • the hotspot routing table includes at least one hotspot prefix corresponding to the forwarding device and information about the outgoing port corresponding to each hotspot prefix
  • the global routing table includes all prefixes corresponding to the forwarding device and each Information about the outgoing port corresponding to the prefix, all prefixes contain at least one hotspot prefix, and the packet is matched in the hotspot routing table and the global routing table based on the longest prefix matching LPM principle.
  • the prefix can be represented by an array composed of 0 and/or 1, and *, the last digit of the prefix is *, and other digits except the last digit are 0 or 1. Among them, * indicates that the bit does not match when performing the longest prefix match.
  • the outbound port corresponding to the message is determined by the longest prefix matching principle, which can avoid hash conflicts and false matches that may be caused by the hash lookup algorithm, and ensure better accuracy.
  • the method further includes: according to the successful prefix matching by the first processing node through the global routing table within a preset time period, and/or, the second processing node
  • the prefixes that are successfully matched through the hotspot routing table in the segment obtain at least one first prefix; if at least one first prefix corresponds to a prefix subtree in the prefix tree obtained based on all prefixes, then according to each first prefix, and, The prefix of the child node in the prefix subtree corresponding to the first prefix is obtained to obtain the target prefix, and the root node of each prefix subtree corresponds to the corresponding first prefix; according to the target prefix and the output port corresponding to the target prefix, the hotspot route is re-determined table; sending the re-determined hotspot routing table to the second processing node.
  • the first processing node may actively obtain the second matching prefix from the second processing node, or the second processing node may actively send information about the second matching prefix to the first processing node.
  • the second processing node may send the hot prefix to the first processing node every time it matches a hot prefix through the hot routing table
  • the information may also be that the second processing node sends the information of the hotspot prefix matched in the corresponding period to the first node at regular intervals (for example, with a preset period of time).
  • the second processing node may regularly send the information of the matched hotspot prefix in a corresponding period to the first node based on the telemetry technology.
  • the hotspot prefix can be determined according to the prefixes of the subnodes in the prefix subtree corresponding to the first prefix.
  • the prefixes of the subnodes in the prefix subtree corresponding to the first prefix can be compared with Routing information with more first prefixes.
  • the prefixes of the child nodes in the prefix subtree corresponding to the first prefix also have more It is most likely to be a prefix that may be matched later.
  • the prefixes of the child nodes in the prefix subtree corresponding to the first prefix may all be used as target prefixes.
  • each first prefix and the prefixes of sub-nodes in the prefix subtree corresponding to the first prefix may also be filtered according to their corresponding egress ports, so as to obtain the target prefix.
  • the above steps if at least one first prefix corresponds to a prefix subtree in the prefix tree obtained based on all prefixes, then according to each first prefix, and, the first The prefixes of the sub-nodes in the prefix subtrees corresponding to the prefixes are used to obtain the target prefixes, including: if at least one first prefix corresponds to a prefix subtree in the prefix tree obtained based on all prefixes, each first prefix, and The prefix of the target child node in each prefix subtree is determined as the target prefix, and the target child node has different output ports corresponding to the parent node in the corresponding prefix subtree.
  • the prefix of any child node in the prefix tree matches the destination IP address of the message
  • the parent node of the child node The prefix must also match the destination IP address of the packet.
  • any packet matching the prefix of the child node can actually be based on the matching of the prefix of the parent node corresponding to the child node
  • the result is used to determine the destination outbound port corresponding to the packet. It can be seen that in the actual matching process, the matching result of the child node can be merged into the matching result of the corresponding parent node.
  • the prefix subtree corresponding to the first prefix can be divided into The child node is used as the target prefix, and the child node corresponding to the corresponding parent node in the prefix subtree corresponding to the first prefix is not used as the target prefix.
  • the above steps determine the target outbound port corresponding to the message according to the global routing table stored in the first processing node, so that the forwarding device forwards the message through the target outbound port, Including: according to the global routing table stored by the first processing node, determine the target output port corresponding to the message; obtain feedback information according to the target output port and the message; send the feedback information to the second processing node, so that the second processing node according to The feedback information forwards the message.
  • the first processing node may implement fast forwarding of the hotspot route according to the hotspot routing table.
  • the second processing node may be an information processing device such as a CPU in the forwarding device.
  • the second processing node in this embodiment of the application, after determining the target outbound port corresponding to the message, according to the target outbound port and message, obtain feedback information, and send the feedback information to the second processing node, so that the second processing node forwards the message according to the information of the target egress port in the target field of the feedback information.
  • the network card speed of the second processing node such as the forwarding chip is usually high, it can bear a large amount of forwarding and the forwarding rate is high, therefore, the second processing node such as the forwarding chip can realize high-speed processing of the message. Forward operations accurately.
  • the above step: obtaining feedback information according to the target egress port and the packet includes:
  • the second processing node can quickly read the information of the target output port corresponding to the message from the feedback information, so as to efficiently forward the message without requiring too much data Queries and excessive processing operations on information have high forwarding efficiency.
  • the second processing node is a forwarding chip
  • the first processing node is a central processing unit CPU.
  • the forwarding chip is used to implement a routing and forwarding function.
  • the CPU can be used to perform operations such as configuring routers, generating routing tables, network management, and analyzing and processing packets.
  • the specific configuration of the CPU is not limited here.
  • the CPU may be a multi-core processor, where different cores may be used to perform different functions, for example, a certain core of the CPU is used to perform operations on the data plane for user data processing and interaction, etc. operation, while another core in the CPU is used to execute the operation of the control plane to execute the operation instructions of the corresponding operating system, such as executing the configuration forwarding protocol, generating and maintaining the hotspot routing table and the global routing table and other operations.
  • the memory of the forwarding chip is generally not large, and as the forwarding volume of routers increases, the memory of the forwarding chip cannot meet the actual needs.
  • the hotspot routing table can be stored in the memory of the forwarding chip instead of the global routing table, thereby reducing the requirement on the memory capacity of the forwarding chip.
  • the computing resources and storage resources of the CPU are significantly better than the forwarding chip.
  • the CPU memory and other storage resources and computing resources in the router can be fully utilized to store the global routing table and match non-hot routes without adding additional hardware to the forwarding device, reducing Reduced device power consumption and hardware cost.
  • the second aspect of the present application provides a method for forwarding a message, the method is applied to the second processing node in the forwarding device, the forwarding device also includes a first processing node, and the method includes: receiving the message; storing the message in the second processing node In the hotspot routing table of the matching message, match the target output port corresponding to the message; if the target output port corresponding to the message is not matched in the hotspot routing table stored in the second processing node, then send the information of the message to the first processing node, So that the first processing node determines the target outbound port corresponding to the message according to the global routing table stored by the first processing node, and the target outbound port is used by the forwarding device to forward the message through the target outbound port.
  • the second processing node forwards the message through the target outbound port.
  • the second processing node can perform fast routing query on the hotspot route, and because the storage space required by the hotspot routing table is less, the search efficiency for the hotspot route is higher, and processing operations such as routing search and forwarding for the hotspot route are of great importance
  • the data processing capability of the second processing node is also relatively low. Therefore, the second processing node can implement efficient routing query for hotspot routing with lower power consumption, storage resources, and hardware costs.
  • the method further includes: receiving feedback information sent by the first processing node, the feedback information is that the first processing node writes the target output port in the target field before the message Obtained from the information; read the information of the target output port in the target field in the feedback information; forward the message according to the read information of the target output port.
  • the information of the target output port is encapsulated into the target field before the message, which can facilitate the second processing node to quickly read the target field, and then according to the message in the feedback information
  • the forwarding process is simple and efficient.
  • the third aspect of the present application provides a device for forwarding messages.
  • the device is applied to the first processing node in the forwarding device.
  • the forwarding device also includes a second processing node.
  • the device has the function of realizing any one of the first aspect or the first aspect A function of the method of a possible implementation. This function may be implemented by hardware, or may be implemented by executing corresponding software on the hardware.
  • the hardware or software includes one or more modules corresponding to the above functions, for example: a receiving module and a processing module.
  • the fourth aspect of the present application provides a first processing node.
  • the first processing node includes at least one processor, a memory, a communication interface, and computer-executed instructions stored in the memory and operable on the processor.
  • the processor executes, the processor executes the method according to the first aspect or any possible implementation manner of the first aspect.
  • the fifth aspect of the present application provides a computer-readable storage medium that stores one or more computer-executable instructions.
  • the processor executes any one of the above-mentioned first aspect or the first aspect. method of implementation.
  • the sixth aspect of the present application provides a computer program product that stores one or more computer-executable instructions.
  • the processor executes any of the above-mentioned first aspect or any possible implementation of the first aspect. Methods.
  • a seventh aspect of the present application provides a system-on-a-chip, where the system-on-a-chip includes a processor, configured to support a control device to implement the functions involved in the above-mentioned first aspect or any possible implementation manner of the first aspect.
  • the chip system may further include a memory, and the memory is used to store necessary program instructions and data for controlling the device.
  • the system-on-a-chip may consist of chips, or may include chips and other discrete devices.
  • the eighth aspect of the present application provides a device for forwarding messages.
  • the device is applied to the second processing node in the forwarding device.
  • the forwarding device also includes a first processing node.
  • the device has the function of realizing any one of the second aspect or the second aspect.
  • a function of the method of a possible implementation. This function may be implemented by hardware, or may be implemented by executing corresponding software on the hardware.
  • the hardware or software includes one or more modules corresponding to the above functions, for example: a receiving module, a matching module and a sending module.
  • a ninth aspect of the present application provides a second processing node, the second processing node includes at least one processor, a memory, a communication interface, and computer-executed instructions stored in the memory and executable on the processor, when the computer-executed instructions are executed When the processor executes, the processor executes the method according to the second aspect or any possible implementation manner of the second aspect.
  • the tenth aspect of the present application provides a computer-readable storage medium storing one or more computer-executable instructions.
  • the processor executes any one of the above-mentioned second aspect or the second aspect. method of implementation.
  • the eleventh aspect of the present application provides a computer program product that stores one or more computer-executable instructions.
  • the processor executes any possible implementation of the above-mentioned second aspect or the second aspect. way of way.
  • a twelfth aspect of the present application provides a system-on-a-chip, where the system-on-a-chip includes a processor, configured to support a control device to implement the functions involved in the above-mentioned second aspect or any possible implementation manner of the second aspect.
  • the chip system may further include a memory, and the memory is used to store necessary program instructions and data for controlling the device.
  • the system-on-a-chip may consist of chips, or may include chips and other discrete devices.
  • the thirteenth aspect of the present application provides a forwarding device, the forwarding device includes a first processing node and a second processing node, the first processing node is used to implement the first aspect or any possible implementation of the first aspect
  • the second processing node is configured to implement the method according to the second aspect or any possible implementation manner of the second aspect.
  • the technical effects brought about by the third aspect to the seventh aspect or any one of the possible implementations can refer to the technical effects brought about by the first aspect or any one of the possible implementations of the first aspect, the eighth aspect to For the technical effects brought about by the twelfth aspect, refer to the technical effects brought about by the second aspect or any possible implementation manner of the second aspect, which will not be repeated here.
  • FIG. 1 is a schematic diagram of a network architecture provided by an embodiment of the present application.
  • FIG. 2 is a schematic diagram of an embodiment of a method for forwarding a message provided in an embodiment of the present application
  • FIG. 3 is a schematic diagram of an embodiment of a method for forwarding a message provided by an embodiment of the present application
  • Fig. 4a is an exemplary schematic diagram of a prefix tree provided by an embodiment of the present application.
  • Fig. 4b is an exemplary schematic diagram of the prefix subtree provided by the embodiment of the present application.
  • Fig. 5a is an exemplary schematic diagram of a prefix tree provided by an embodiment of the present application.
  • Fig. 5b is an exemplary schematic diagram of the prefix subtree provided by the embodiment of the present application.
  • FIG. 6 is a schematic diagram of an embodiment of a method for forwarding a message provided in an embodiment of the present application
  • FIG. 7 is a schematic structural diagram of an exemplary structure of feedback information provided by an embodiment of the present application.
  • FIG. 8 is a schematic diagram of an embodiment of a device for forwarding a message provided in an embodiment of the present application.
  • FIG. 9 is a schematic diagram of an embodiment of a device for forwarding a message provided in an embodiment of the present application.
  • FIG. 10 is a schematic structural diagram of a first processing node provided by an embodiment of the present application.
  • FIG. 11 is a schematic structural diagram of a second processing node provided by an embodiment of the present application.
  • FIG. 12 is a schematic structural diagram of a forwarding device provided by an embodiment of the present application.
  • the embodiment of the present application provides a method for forwarding messages, which is used to solve the problem that the forwarding volume of the current forwarding device is increasing, and the storage demand corresponding to the routing table is also increasing, resulting in the forwarding chip that provides the forwarding function in the forwarding device
  • the storage pressure of hardware and other hardware and the pressure of routing query are relatively high, which often cannot meet the needs of application scenarios.
  • Embodiments of the present application also provide corresponding devices, computer equipment, computer-readable storage media, computer program products, and the like.
  • the forwarding device may be a switch, a router, or a gateway device.
  • FIG. 1 it is a schematic diagram of a network architecture.
  • the information transmission path between the terminal device and the server usually includes one or more forwarding devices.
  • the forwarding device in this application may be the router 12 or the switch 13 in FIG. 1 .
  • An embodiment of the method for forwarding a message provided in the embodiment of the present application may be applied to the above-mentioned forwarding device.
  • the method for forwarding a message provided in the embodiment of the present application will be introduced below with reference to the accompanying drawings.
  • the forwarding device includes a first processing node and a second processing node.
  • the first processing node and the second processing node may be different physical modules in the forwarding device, or may be different virtual machines or different containers in the forwarding device.
  • the first processing node may be a central processing unit (central processing unit, CPU), a field-programmable gate array (field-programmable gate array, FPGA) or other devices with data analysis functions in the forwarding device.
  • the second processing node may be an integrated circuit (application specific integrated circuit, ASIC) forwarding chip, or a forwarding chip such as a network processor (network processor, NP) chip capable of implementing a routing and forwarding function.
  • ASIC application specific integrated circuit
  • NP network processor
  • an embodiment of the method for forwarding a message provided by the embodiment of the present application includes:
  • the second processing node receives a packet.
  • the message received by the second processing node may come from other forwarding devices connected to the forwarding device, for example, other routing forwarding devices or other switch forwarding devices; it may also come from other non-forwarding devices, for example, from service gateways, signaling Gateways, security gateways, servers, and terminal devices, etc., are not limited here.
  • the message can be directly received from other devices (such as other forwarding devices or other non-forwarding devices) by the input port of the second processing node, or it can be received from the input ports of other modules in the forwarding device except the second processing node Received, and then passed to the second processing node.
  • the specific format of the message can be determined based on the transmission protocol corresponding to the forwarding device.
  • the message may be a transmission control protocol (transmission control protocol, TCP) message.
  • the second processing node matches the target egress port corresponding to the packet in the hotspot routing table stored by the second processing node.
  • the routing table is used to find the corresponding outgoing port in the forwarding device according to the destination IP address of the message.
  • the routing table may include a hotspot routing table and a global routing table.
  • the hotspot routing table may include, but is not limited to, information about egress ports that are used more frequently by the forwarding device when forwarding packets within a certain period of time.
  • the global routing table may include relevant information of all outgoing ports corresponding to packet forwarding by the forwarding device.
  • the hotspot routing table may be stored in a storage space such as a memory of the second processing node, and the global routing table may be stored in a storage space such as a memory of the first processing node.
  • the specific information contained in the hotspot routing table and the method for the second processing node to match the target egress port corresponding to the packet may be determined based on the principle adopted by the forwarding device for routing lookup.
  • the forwarding device performs route lookup based on the longest prefix match (longest prefix match, LPM) principle
  • the hotspot routing table includes at least one hotspot prefix corresponding to the forwarding device and information about the outgoing port corresponding to each hotspot prefix
  • the global routing table includes all the prefixes corresponding to the forwarding device and the information of the outgoing port corresponding to each prefix
  • all prefixes contain at least one hotspot prefix
  • the packet is based on the longest prefix matching LPM principle in the hotspot routing table and the global routing table matched.
  • the forwarding device performs routing lookup based on a hash lookup algorithm
  • the hotspot routing table and the global routing table are respectively in the form of a hash table
  • the hash table may include hashes obtained based on preset addresses. Values and information such as the outgoing port corresponding to each hash value.
  • the hash value corresponding to the destination IP address can be calculated based on the destination IP address of the message and the hash algorithm corresponding to the routing table, and then matched in the hotspot routing table according to the hash value corresponding to the destination IP address.
  • the specific matching method can be determined based on the corresponding hash lookup algorithm and the specific setting method of the hotspot routing table, which is not limited here.
  • the second processing node sends information of the packet to the first processing node.
  • the second processing node can directly send the message to the first processing node, or only send the information of the destination IP address of the message, or after processing the message such as encapsulation, the encapsulated message
  • the data packet of the text is sent to the first processing node.
  • the second processing node if the target egress port corresponding to the packet is matched in the hotspot routing table stored by the second processing node, the second processing node forwards the packet through the target egress port.
  • the second processing node can perform high-speed forwarding of the hotspot route, and because the storage space required by the hotspot routing table is less, the search efficiency for the hotspot route is higher, and processing operations such as routing search and forwarding for the hotspot route are of great importance to the second
  • the data processing capability of the processing node is also relatively low. Therefore, the second processing node can realize high-speed forwarding of hotspot routes with low power consumption, storage resources, and hardware costs.
  • the hotspot route is usually the route that is used more frequently in the route forwarding processing of the forwarding device, therefore, in many cases, the message can be efficiently matched to the corresponding target output port through the hotspot routing table in the second processing node , and efficiently forwarded through the second processing node.
  • the first processing node receives information about the packet sent by the second processing node.
  • the packet does not match the corresponding target egress port in the hotspot routing table stored in the second processing node.
  • the first processing node determines the target egress port corresponding to the packet according to the global routing table stored by the first processing node, so that the forwarding device forwards the packet through the target egress port.
  • the global routing table may include relevant information of all egress ports corresponding to packet forwarding by the forwarding device.
  • the global routing table may be stored in a storage space such as a memory of the first processing node.
  • the specific information contained in the global routing table and the method for the first processing node to match the target egress port corresponding to the packet according to the global routing table may be determined based on the principle adopted by the forwarding device for routing lookup.
  • the global routing table includes all the prefixes corresponding to the forwarding device and the information of the outgoing port corresponding to each prefix, then the packet is processed in the hotspot routing table and the global routing table based on the longest prefix matching LPM principle matched.
  • the forwarding device performs routing lookup based on a hash lookup algorithm, and the global routing table is in the form of a hash table. Information such as the hash value and the outgoing port corresponding to each hash value.
  • the hash value corresponding to the destination IP address can be calculated based on the destination IP address of the message and the hash algorithm corresponding to the routing table, and then the hash value corresponding to the destination IP address can be stored in the hotspot routing table.
  • the specific matching method can be determined based on the corresponding hash lookup algorithm and the specific setting method of the global routing table, which is not limited here.
  • the message may be forwarded by the first processing node through the target output port, or other nodes (such as the second processing node) to forward the message.
  • the first processing node may determine the target output port corresponding to the message according to the global routing table stored by the first processing node, so that the forwarding device forwards the message through the target output port. In this way, the storage resources and data processing resources of the first processing node can be reasonably utilized to match non-hotspot routing information, so as to improve the forwarding performance of the forwarding device.
  • the second processing node is a forwarding chip
  • the first processing node is a central processing unit CPU.
  • the forwarding chip is used to realize the routing and forwarding function.
  • the forwarding chip can be an integrated circuit (application specific integrated circuit, ASIC) forwarding chip, or a network processor (network processor, NP) chip; of course, the forwarding chip can also be other types of chips, and this application Not limiting.
  • ASIC application specific integrated circuit
  • NP network processor
  • the first processing node may be a central processing unit (central processing unit, CPU) in the forwarding device.
  • the CPU can be used to perform operations such as configuring routers, generating routing tables, network management, and analyzing and processing packets.
  • the specific configuration of the CPU is not limited here.
  • the CPU may be a multi-core processor, where different cores may be used to perform different functions, for example, a certain core of the CPU is used to perform operations on the data plane for user data processing and interaction, etc. operation, while another core in the CPU is used to execute the operation of the control plane to execute the operation instructions of the corresponding operating system, such as executing the configuration forwarding protocol, generating and maintaining the hotspot routing table and the global routing table and other operations.
  • the memory of the forwarding chip is generally not large, and as the forwarding volume of routers increases, the memory of the forwarding chip cannot meet the actual needs.
  • the memory is usually expanded by expanding the memory of the forwarding chip.
  • the forwarding chip it is necessary to connect an FPGA to the forwarding chip, and then connect a dynamic random access memory (dynamic random access memory, DRAM) or a ternary content addressable memory (ternary content addressable memory) through the external FPGA. , TCAM) memory.
  • DRAM dynamic random access memory
  • TCAM ternary content addressable memory
  • the forwarding chip needs to use the external FPGA to control the data access of the memory external to the FPGA.
  • the cost of the hardware will increase.
  • the external FPGA and memory will also increase the power consumption of the forwarding device.
  • the data storage capability of the forwarding chip can also be expanded through an external server.
  • the forwarding chip forwards the received message to the remote server through technologies such as remote direct memory access (RDMA), and then uses the remote server to query the corresponding information of the message according to the routing table stored in the remote server. outbound port, and then forward the message from the server according to the corresponding outbound port.
  • RDMA remote direct memory access
  • the message needs to be transmitted at high speed between the forwarding device and the server, the reliability of information transmission may be difficult to guarantee, and the performance of the network card configured on the remote server needs to be better, resulting in higher cost.
  • the hotspot routing table can be stored in the memory of the forwarding chip instead of the global routing table, thereby reducing the requirement on the memory capacity of the forwarding chip.
  • the computing resources and storage resources of the CPU are significantly better than the forwarding chip.
  • storage resources such as CPU memory and computing resources in the router can be fully utilized to store the global routing table and match non-hot routes without adding additional hardware to the forwarding device, reducing the number of devices. Power consumption and hardware cost.
  • the hotspot routing table includes information on at least one hotspot prefix corresponding to the forwarding device and the outgoing port corresponding to each hotspot prefix
  • the global routing table includes information on all prefixes corresponding to the forwarding device and the outgoing port corresponding to each prefix , all prefixes contain at least one hotspot prefix, and packets are matched in the hotspot routing table and the global routing table based on the longest prefix matching LPM principle.
  • the prefix can be represented by an array consisting of 0 and/or 1, and *, the last bit of the array is *, and other bits except the last bit are 0 or 1. Among them, * indicates that the bit does not match when performing the longest prefix match.
  • the prefix corresponding to each egress port can be determined based on the IP address of the egress port and the subnet mask corresponding to the IP address. Specifically, the binary network bits of the subnet mask corresponding to the IP address and the corresponding bits of the binary IP address of the output port can be logically ANDed, and then the result of the logical AND operation can be used as the output corresponding to the output port. prefix.
  • the hotspot routing table when matching based on the longest prefix matching LPM principle, for each outgoing port in the hotspot routing table, the binary destination IP address corresponding to the packet can be compared with the hotspot routing table The logical AND operation is performed on the binary network bits of the subnet mask corresponding to the corresponding outgoing port. If the result of the logical AND operation is the same as the hotspot prefix corresponding to the outgoing port, it can be considered that the outgoing port matches the packet. Then, from the matching outbound ports, select the outbound port with the longest corresponding hotspot prefix as the target outbound port of the message.
  • the hotspot prefix is part of all prefixes.
  • the user may select one or more prefixes from all prefixes as a hotspot prefix, or use a prefix whose number of successful matches reaches a specified number of times within a specified period of time as a hotspot prefix, or select a prefix that matches within a specified period of time
  • the related prefixes of prefixes whose success times reach the specified number of times are used as hot prefixes.
  • the related prefixes of any prefix can be predetermined by the user, or can be described according to the similarity between any prefix and the related prefix.
  • the outbound port corresponding to the message is determined by the longest prefix matching principle, which can avoid false matching caused by the hash collision of the hash lookup algorithm and ensure better routing query accuracy.
  • the method also includes:
  • the second processing node successfully matches the prefixes through the hotspot routing table within a preset time period, obtain at least one first prefix.
  • At least one first prefix corresponds to a prefix subtree in the prefix tree obtained based on all prefixes, then according to each first prefix and the prefix of the child node in the prefix subtree corresponding to the first prefix, obtain The target prefix, the root node of each prefix subtree corresponds to the corresponding first prefix.
  • the above steps may be applied to the first processing node.
  • the prefix that the first processing node successfully matches through the global routing table within the preset time period is called the first matching prefix
  • the prefix that the second processing node passes through the hotspot within the preset time period The prefix that is successfully matched in the routing table is called the second matching prefix.
  • the first processing node may collect the prefixes that the first processing node successfully matches through the global routing table within a preset time period and the prefixes that the second processing node successfully matches through the hotspot routing table within a preset time period
  • the information that is, collect the information of the first matching prefix and the second matching prefix, and obtain the matching result corresponding to the preset time period.
  • the matching result may include the first matching prefix and/or the second matching prefix.
  • the first processing node may actively obtain the second matching prefix from the second processing node, or the second processing node may actively send information about the second matching prefix to the first processing node.
  • the second processing node may send the hot prefix to the first processing node every time it matches a hot prefix through the hot routing table
  • the information may also be that the second processing node sends the information of the hotspot prefix matched in the corresponding period to the first node at regular intervals (for example, with a preset period of time).
  • the second processing node may regularly send information about hotspot prefixes matched within a corresponding period to the first node based on the telemetry technology.
  • each first matching prefix and each second matching prefix can be used as the first prefix, or based on the corresponding The number of matches and/or the memory size of the second processing node are filtered from the first matching prefix and the second matching prefix to obtain the first prefix.
  • the threshold value of the number of routing information that can be included in the hotspot routing table can be determined according to conditions such as the memory size of the second processing node, where each routing information corresponds to a prefix, and each routing information contains corresponding A prefix of , and the information of the outgoing port corresponding to the prefix. If the total number of the first matching prefix and the second matching prefix is not greater than the number threshold, each first matching prefix and each second matching prefix is used as the first prefix.
  • N is a positive integer, and the value of N is not greater than the number threshold.
  • the target prefixes may be determined from the first prefixes and other prefixes associated with each first prefix.
  • At least one first prefix corresponds to a prefix subtree in the prefix tree obtained based on all prefixes, then according to each first prefix, and the prefix of the child node in the prefix subtree corresponding to the first prefix, Get target prefix.
  • the prefix tree is also called the trie tree.
  • a prefix tree can be a binary tree or a multi-fork tree.
  • the prefix tree includes a root node.
  • the root node of the prefix tree may not contain characters.
  • the difference between the prefix of any child node of the prefix tree and the prefix of the parent node of the child node is the prefix of the child node.
  • Any child node The prefix of the parent node of the child node has M more digits before the trailing "*" than the prefix of the parent node of the child node, and the prefix of any child node, except for the extra M digits, is the same as the parent node of the child node Nodes have the same prefix.
  • the value of M can be 1 or other positive integers.
  • M is also called the stride of the prefix tree.
  • Each node in the prefix tree is in one-to-one correspondence with each prefix in all prefixes.
  • the prefix tree and the prefix subtree are used to describe an association relationship between data, and the association relationship can be represented by a tree-shaped data storage structure.
  • Each node in the prefix tree can be identified by a one-to-one corresponding prefix, or can be identified by a one-to-one corresponding number.
  • any node in the prefix tree corresponds to a child node in the prefix tree
  • the node also corresponds to a prefix subtree in the prefix tree, and this node is the root of the corresponding prefix subtree node.
  • the prefix of any child node in the prefix tree matches the destination IP address of the message
  • the prefix of the parent node of the child node must also match the destination IP address of the message.
  • the IP address matches. Since the prefix corresponding to any child node in the prefix tree is longer than the prefix corresponding to the parent node of the child node, it can be considered that the routing information contained in the prefix corresponding to the child node is more specific, so that the routing information can be better Ensure accurate forwarding of packets. Therefore, the hotspot prefix can be determined according to the prefixes of the subnodes in the prefix subtree corresponding to the first prefix.
  • the prefixes of the subnodes in the prefix subtree corresponding to the first prefix can be compared with Routing information with more first prefixes.
  • the prefixes of the child nodes in the prefix subtree corresponding to the first prefix also have more It is most likely to be a prefix that may be matched later.
  • the prefixes of the child nodes in the prefix subtree corresponding to the first prefix may all be used as target prefixes.
  • each first prefix and the prefixes of sub-nodes in the prefix subtree corresponding to the first prefix can also be filtered according to their corresponding egress ports, so as to obtain the target prefix.
  • Table 1 it is an exemplary global routing table.
  • each prefix not only corresponds to an egress port, but also corresponds to a number, which can be used to identify the corresponding prefix.
  • FIG. 4a it is a prefix tree corresponding to the global routing table in Table 1.
  • Each node in the prefix tree in Fig. 5a corresponds to the prefix in Table 1 one by one.
  • Table 2 it is an exemplary hotspot routing table corresponding to the global routing table in Table 1.
  • the hotspot routing table includes not only the prefixes 0110* and 010* with the specified number of successful matches within the specified time period, but also the prefix 0101* of the child node corresponding to the prefix 0110*, and the prefix of the child node corresponding to 010* 0101*, 01011*, 0100*, 01001*.
  • the first processing node may repeatedly execute the above steps 301-304 at a specified period.
  • the duration of each cycle may be the duration of the preset time period.
  • the above steps 301-304 may also be performed in response to a designated operation by the user.
  • the above step 304 is performed, that is, the re-determined hotspot routing table is sent to the second processing node. If the re-determined hotspot routing table is the same as the hotspot routing table before being re-determined, the above step 304 may not be performed, that is, the re-determined hotspot routing table is not sent to the second processing node.
  • the above step 302 includes:
  • each first prefix and the prefix of the target child node in each prefix subtree are determined as the target prefix, and the target Child nodes have different egress ports corresponding to their parent nodes in the corresponding prefix subtree.
  • the prefixes corresponding to the prefix subtree corresponding to the first prefix may be filtered according to their corresponding egress ports.
  • the prefix of any child node in the prefix tree matches the destination IP address of the message
  • the prefix of the parent node of the child node must also match the destination IP address of the message. The IP address matches.
  • the outbound port corresponding to the child node is the same as the outbound port corresponding to the corresponding parent node
  • any packet matching the prefix of the child node can actually be based on the matching of the prefix of the parent node corresponding to the child node It can be seen that in the actual matching process, the matching result of the child node can be merged into the matching result of the corresponding parent node.
  • the child nodes corresponding to the corresponding parent nodes that have different outgoing ports can be As the target prefix, the sub-nodes corresponding to the corresponding parent node in the prefix subtree corresponding to the first prefix and having the same output port are not used as the target prefix.
  • Table 3 it is an exemplary global routing table.
  • FIG. 5a it is a prefix tree corresponding to the global routing table in Table 3.
  • the first processing node matches the successful prefix through the global routing table within the preset period of time and the second processing node passes the hotspot route within the preset period of time
  • the prefixes that match the table successfully are P2:0110* and P4:010*.
  • the child nodes in the prefix subtree of P2 include P3:01101* and P9:01100*.
  • the egress port of P3 is different from that of P2, therefore, P3 is also used as the destination prefix.
  • the egress port of P9 is the same as that of P2, so P9 is not used as the target prefix, but can be combined in the case of matching the prefix of P2.
  • the child nodes in the prefix subtree of P4:010* include P5:0101*, P6:01011*, P7:0100*, P8:01001* and P10:01000*.
  • the outbound port of P5:0101* is the same as that of its parent node P4, so it is not used as the target prefix.
  • the egress ports of P6: 01011*, P7: 0100*, P8: 01001* and P10: 01000* are different from their corresponding parent nodes, so they are all used as the target prefix.
  • the hotspot routing table obtained according to the target prefix is shown in Table 4.
  • the above step 205 includes:
  • the first processing node determines a target egress port corresponding to the packet according to the global routing table stored by the first processing node.
  • the first processing node obtains feedback information according to the target egress port and the packet.
  • the first processing node sends feedback information to the second processing node.
  • the second processing node receives the feedback information sent by the first processing node.
  • the second processing node reads information about the target egress port in the target field in the feedback information.
  • the second processing node forwards the packet according to the read information about the target egress port.
  • the specific form of the feedback information is not limited here.
  • the packet added with the header structure may be encapsulated.
  • VLAN virtual local area network
  • VLAN virtual local area network
  • the first processing node may implement fast forwarding of the hotspot route according to the hotspot routing table.
  • the second processing node may be an information processing device such as a CPU in the forwarding device.
  • the transmission rate of the network card in the CPU and other information processing equipment is generally relatively low.
  • congestion is likely to occur.
  • the feedback information can be obtained according to the target output port and the message, and The feedback information is sent to the second processing node, so that the second processing node forwards the message according to the information of the target egress port in the target field of the feedback information.
  • the network card speed of the second processing node such as the forwarding chip is usually high, it can bear a large amount of forwarding and the forwarding rate is high, therefore, the second processing node such as the forwarding chip can realize high-speed processing of the message. Forward operations accurately.
  • the above step: obtaining feedback information according to the target egress port and the message includes:
  • the information of the target output port is encapsulated into the target field before the message, which can facilitate the second processing node to quickly read the target field, and then perform fast forwarding according to the message in the feedback information , the forwarding process is simple and efficient.
  • the target field may be added to the front of the message by the first processing node after receiving the message, or the second processing node may add to before the message.
  • the number of bits of the target field may be fixed in advance, or may vary based on the size of the information of the target egress port.
  • other contents besides the information of the target egress port may be included before the packet.
  • FIG. 7 an exemplary structure of feedback information is shown in FIG. 7 .
  • the feedback information starts from the header, and may include in turn the header identifier used to identify the starting position, the information of the virtual local area network (virtual local area network, VLAN) of the message, and the information corresponding to the message.
  • the header identifier used to identify the starting position
  • the information of the virtual local area network (virtual local area network, VLAN) of the message and the information corresponding to the message.
  • the header structure may be added before the received message by the first processing node.
  • the second processing node when it does not match the corresponding target output port in the hotspot routing table, it adds the message with the header structure before the message, and then sends the message with the header structure to the first
  • the processing node after the first processing node determines the target output port corresponding to the message according to the global routing table stored by the first processing node, writes the information of the target output port into the target field in the header structure to obtain feedback information, and then Send feedback information to the second processing node.
  • the second processing node can quickly read the information of the target output port corresponding to the message from the feedback information, so as to efficiently forward the message without doing too much data query and Excessive processing of information, high forwarding efficiency.
  • the embodiment of the present application has introduced the message forwarding method from multiple aspects.
  • the following describes the message forwarding device applied to the first processing node of the forwarding device and the first processing node of the forwarding device in combination with the accompanying drawings. 2.
  • this embodiment of the present application provides an apparatus 800 for forwarding packets, and the apparatus 800 can be applied to the first processing node of the forwarding device.
  • An embodiment of the device 800 includes:
  • the receiving module 801 is configured to receive the information of the message sent by the second processing node, and the message does not match the corresponding target output port in the hotspot routing table stored by the second processing node;
  • the processing module 802 is configured to determine the target outbound port corresponding to the message according to the global routing table stored in the first processing node, so that the forwarding device forwards the message through the target outbound port.
  • the hotspot routing table includes information about at least one hotspot prefix corresponding to the forwarding device and the outgoing port information corresponding to each hotspot prefix
  • the global routing table includes information about all prefixes corresponding to the forwarding device and information about the outgoing port corresponding to each prefix.
  • the prefix contains at least one hotspot prefix, and the packet is matched in the hotspot routing table and the global routing table based on the longest prefix matching LPM principle.
  • processing module 802 is also used for:
  • At least one first prefix corresponds to a prefix subtree in the prefix tree obtained based on all prefixes, then according to each first prefix and the prefix of the child node in the prefix subtree corresponding to the first prefix, obtain the target prefix , the root node of each prefix subtree corresponds to the corresponding first prefix;
  • processing module 802 is used for:
  • each first prefix and the prefix of the target child node in each prefix subtree are determined as the target prefix, and the target Child nodes have different egress ports corresponding to their parent nodes in the corresponding prefix subtree.
  • processing module 802 is used for:
  • processing module 802 is used for:
  • an embodiment of the present application provides an apparatus 900 for forwarding a packet, and the apparatus 900 may be applied to a second processing node of a forwarding device.
  • An embodiment of the device 900 includes:
  • a matching module 902 configured to match the target output port corresponding to the message in the hotspot routing table stored in the second processing node;
  • the sending module 903 is configured to send the information of the message to the second processing node if the target output port corresponding to the message is not matched in the hotspot routing table stored by the second processing node, so that the second processing node according to the second
  • the global routing table stored by the processing node determines the target output port corresponding to the message, and the target output port is used for the forwarding device to forward the message through the target output port.
  • the device 900 also includes a reading module 904 and a forwarding module 905;
  • the receiving module 901 is further configured to: receive the feedback information sent by the first processing node, the feedback information is obtained by the first processing node writing the information of the target output port in the target field before the message;
  • the reading module 904 is configured to: read the information of the target output port in the target field in the feedback information;
  • the forwarding module 905 is configured to: forward the message according to the read information of the target egress port.
  • FIG. 10 is a schematic diagram of a possible logical structure of the first processing node 1000 provided by the embodiment of the present application.
  • the first processing node 1000 includes: a memory 1001 , a processor 1002 , a communication interface 1003 and a bus 1004 .
  • the memory 1001 , the processor 1002 , and the communication interface 1003 are connected to each other through a bus 1004 .
  • the memory 1001 may be a read-only memory (Read Only Memory, ROM), a static storage device, a dynamic storage device, or a random access memory (Random Access Memory, RAM).
  • the memory 1001 can store a program, and when the program stored in the memory 1001 is executed by the processor 1002, the processor 1002 and the communication interface 1003 are used to execute steps 204, 205, 301-304, 601 of the above-mentioned embodiment of the method for forwarding a message -603 etc.
  • the processor 1002 can adopt a central processing unit (Central Processing Unit, CPU), a microprocessor, an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a graphics processing unit (graphics processing unit, GPU), a digital signal processor (Digital Signal Processing, DSP), application-specific integrated circuit (ASIC), off-the-shelf programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or any combination thereof, for Executing relevant programs to realize the functions required to be performed by the receiving module, processing module, etc.
  • CPU Central Processing Unit
  • ASIC Application Specific Integrated Circuit
  • ASIC Application Specific Integrated Circuit
  • GPU graphics processing unit
  • DSP Digital Signal Processing
  • ASIC application-specific integrated circuit
  • FPGA Field Programmable Gate Array
  • Steps 204, 205, 301-304, 601-603, etc. of the example may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register.
  • the storage medium is located in the memory 1001, and the processor 1002 reads the information in the memory 1001, and executes steps 204, 205, 301-304, 601-603, etc. of the above-mentioned embodiment of the method for forwarding packets in combination with its hardware.
  • the communication interface 1003 implements communication between the first processing node 1000 and other devices or communication networks by using a transceiver device such as but not limited to a transceiver. For example, information exchange may be performed with the second processing node through the communication interface 1003 .
  • the bus 1004 can implement a path for transmitting information between various components of the first processing node 1000 (for example, the memory 1001 , the processor 1002 and the communication interface 1003 ).
  • the bus 1004 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (Extended Industry Standard Architecture, EISA) bus, etc.
  • PCI Peripheral Component Interconnect
  • EISA Extended Industry Standard Architecture
  • the bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one thick line is used in FIG. 10 , but it does not mean that there is only one bus or one type of bus.
  • a computer-readable storage medium stores computer-executable instructions.
  • the processor of the device executes the computer-executable instructions
  • the device executes the above-mentioned steps in FIG. 10. The steps performed by the processor.
  • a computer program product includes computer-executable instructions stored in a computer-readable storage medium; when the processor of the device executes the computer-executable instructions , the device executes the above-mentioned steps executed by the processor in FIG. 10 .
  • a chip system is further provided, and the chip system includes a processor, and the processor is configured to implement the steps performed by the processor in FIG. 10 above.
  • the system-on-a-chip may further include a memory, and the memory is used for storing necessary program instructions and data of the device for writing data.
  • the system-on-a-chip may consist of chips, or may include chips and other discrete devices.
  • FIG. 11 is a schematic diagram of a possible logical structure of the second processing node 1100 provided in the embodiment of the present application.
  • the second processing node 1100 includes: a memory 1101 , a processor 1102 , a communication interface 1103 and a bus 1104 .
  • the memory 1101 , the processor 1102 , and the communication interface 1103 are connected to each other through a bus 1104 .
  • the memory 1101 may be a read-only memory (Read Only Memory, ROM), a static storage device, a dynamic storage device, or a random access memory (Random Access Memory, RAM).
  • the memory 1101 can store programs, and when the programs stored in the memory 1101 are executed by the processor 1102, the processor 1102 and the communication interface 1103 are used to execute steps 201-203, 604-606, etc. of the above-mentioned embodiment of the method for forwarding packets.
  • the processor 1102 may adopt a central processing unit (Central Processing Unit, CPU), a microprocessor, an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a graphics processing unit (graphics processing unit, GPU), a digital signal processor (Digital Signal Processing, DSP), application-specific integrated circuit (ASIC), off-the-shelf programmable gate array (Field Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or any combination thereof, for Execute relevant programs to realize the functions required to be performed by the receiving module, matching module, and sending module in the device for forwarding messages of the second processing node in the above embodiment, or execute the forwarding of messages in the method embodiments of the present application Steps 201-203, 604-606, etc.
  • CPU Central Processing Unit
  • ASIC Application Specific Integrated Circuit
  • ASIC Application Specific Integrated Circuit
  • GPU graphics processing unit
  • DSP Digital Signal Processing
  • ASIC application-specific integrated circuit
  • FPGA off-the-shelf
  • the steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor.
  • the software module can be located in a mature storage medium in the field such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, register.
  • the storage medium is located in the memory 1101, and the processor 1102 reads the information in the memory 1101, and executes steps 201-203, 604-606, etc. of the above-mentioned embodiment of the method for forwarding a message in combination with its hardware.
  • the communication interface 1103 implements communication between the second processing node 1100 and other devices or communication networks by using a transceiver device such as but not limited to a transceiver. For example, information exchange may be performed with the first processing node, a terminal device, other forwarding devices, or a server.
  • the bus 1104 can implement a path for transmitting information between various components of the second processing node 1100 (for example, the memory 1101 , the processor 1102 and the communication interface 1103 ).
  • the bus 1104 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (Extended Industry Standard Architecture, EISA) bus, etc.
  • PCI Peripheral Component Interconnect
  • EISA Extended Industry Standard Architecture
  • the bus can be divided into address bus, data bus, control bus and so on. For ease of representation, only one thick line is used in FIG. 11 , but it does not mean that there is only one bus or one type of bus.
  • a computer-readable storage medium in which computer-executable instructions are stored, and when the processor of the device executes the computer-executable instructions, the device executes the above-mentioned steps in Figure 11. The steps performed by the processor.
  • a computer program product includes computer-executable instructions stored in a computer-readable storage medium; when the processor of the device executes the computer-executable instructions , the device executes the steps executed by the processor in FIG. 11 above.
  • a system-on-a-chip is further provided, and the system-on-a-chip includes a processor configured to implement the above-mentioned steps performed by the processor in FIG. 11 .
  • the system-on-a-chip may further include a memory, and the memory is used for storing necessary program instructions and data of the device for writing data.
  • the system-on-a-chip may consist of chips, or may include chips and other discrete devices.
  • a forwarding device 1200 is further provided, and the forwarding device 1200 includes a first processing node 1000 and a second processing node 1100 .
  • the disclosed systems, devices and methods may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components can be combined or integrated. to another system, or some features may be ignored, or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
  • a unit described as a separate component may or may not be physically separated, and a component displayed as a unit may or may not be a physical unit, that is, it may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the embodiment of the present application may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
  • the functions are realized in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium.
  • the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods in the various embodiments of the embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disc and other media that can store program codes. .

Landscapes

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

Abstract

本申请公开了一种转发报文的方法,该方法应用于转发设备中的第一处理节点,转发设备还包括第二处理节点,该方法包括:接收第二处理节点发送的报文的信息,报文在第二处理节点存储的热点路由表中未匹配到对应的目标出端口;根据第一处理节点存储的全局路由表,确定报文对应的目标出端口,以使得转发设备通过目标出端口对报文进行转发。这样,第二处理节点可以以较低的功耗、存储资源和硬件成本,基于热点路由信息来实现高效地路由查询,此外,还可以合理利用第一处理节点的存储资源和数据处理资源来匹配非热点路由信息,以提升转发设备的转发性能。

Description

转发报文的方法以及相关设备
本申请要求于2021年11月17日提交的、中国申请号为202111373018.2、发明名称为“转发报文的方法以及相关设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及转发设备技术领域,具体涉及转发报文的方法以及相关设备。
背景技术
诸如路由器、交换机等转发设备可以对接收到的报文进行转发。
目前,随着网络应用不断发展,转发设备的转发量越来越大,路由表对应的存储需求也随之增大,导致转发设备中提供转发功能的转发芯片等硬件的存储压力以及路由查询压力较大,常常无法满足应用场景的需要,从而影响了转发设备的转发性能。
发明内容
本申请实施例提供一种转发报文的方法,用于解决目前的转发设备的转发量越来越大,路由表对应的存储需求也随之增大,导致转发设备中提供转发功能的转发芯片等硬件的存储压力以及路由查询压力较大,常常无法满足应用场景的需要的问题。本申请实施例还提供了相应的装置、计算机设备、计算机可读存储介质和计算机程序产品等。
本申请第一方面提供一种转发报文的方法,该方法应用于转发设备中的第一处理节点,转发设备还包括第二处理节点,该方法包括:接收第二处理节点发送的报文的信息,报文在第二处理节点存储的热点路由表中未匹配到对应的目标出端口;根据第一处理节点存储的全局路由表,确定报文对应的目标出端口,以使得转发设备通过目标出端口对报文进行转发。
在上述第一方面中,转发设备可以为交换机(switch)、路由器(router)或者网关设备。第一处理节点和第二处理节点可以是转发设备中不同的物理模块,也可以是转发设备中不同的虚拟机或者不同的容器。路由表(routing table)用于根据报文的目的IP地址,在转发设备中查找对应的出端口。在上述第一方面中,路由表可以包括热点路由表和全局路由表。其中,热点路由表可以包括但不限于转发设备在一定的时间段内进行报文转发时使用次数较多的出端口的相关信息。而全局路由表可以包括转发设备进行报文转发所对应的所有出端口的相关信息。路由表中所包含的具体信息以及确定报文对应的目标出端口的方法可以基于转发设备基于路由表进行路由查找所采用的原则来确定。示例性地,基于路由表进行路由查找所采用的原则可以为最长前缀匹配(longest prefix match,LPM)原则。
该第一方面中,第二处理节点根据热点路由表来匹配接收到的报文对应的目标出端口,这样,第二处理节点可以以较低的功耗、存储资源和硬件成本,基于热点路由信息来实现高效地路由查询。若在第二处理节点存储的热点路由表中没有匹配到报文对应的目标出端口,则第二处理节点向第一处理节点发送报文,使得第一处理节点可以根据第一处理节点存储的全局路由表,确定报文对应的目标出端口,以使得转发设备通过目标出端口对报文进行转发。这样,可以合理利用第一处理节点的存储资源和数据处理资源来匹配非热点路 由信息,以提升转发设备的转发性能。
在第一方面的一种可能的实现方式中,热点路由表包含转发设备对应的至少一个热点前缀和每个热点前缀对应的出端口的信息,全局路由表包括转发设备对应的所有前缀和每个前缀对应的出端口的信息,所有前缀包含至少一个热点前缀,报文是基于最长前缀匹配LPM原则在热点路由表和全局路由表中进行匹配的。
在该种可能的实现方式中,前缀可以通过由0和/或1,以及*组成的数组来表示,前缀的最后一位为*,除最后一位之外的其他位为0或1。其中,*表示在进行最长前缀匹配时,该位不匹配。该种可能的实现方式中,通过最长前缀匹配原则来进行确定报文对应的出端口,可以避免采用哈希查找算法可能导致的哈希冲突以及虚假匹配等情况,保证较好的准确性。
在第一方面的一种可能的实现方式中,该方法还包括:根据第一处理节点在预设时间段内通过全局路由表匹配成功的前缀,和/或,第二处理节点在预设时间段内通过热点路由表匹配成功的前缀,获得至少一个第一前缀;若至少一个第一前缀在基于所有前缀所得到的前缀树中对应有前缀子树,则根据每个第一前缀,以及,第一前缀对应的前缀子树中的子节点的前缀,获得目标前缀,每个前缀子树的根节点与相应的第一前缀对应;根据目标前缀以及目标前缀对应的出端口,重新确定热点路由表;向第二处理节点发送重新确定的热点路由表。
在该种可能的实现方式中,可以是第一处理节点从第二处理节点主动获取第二匹配前缀,也可以是第二处理节点向第一处理节点主动发送第二匹配前缀的信息。该第二处理节点向第一处理节点主动发送第二匹配前缀的信息时,可以是第二处理节点每次通过热点路由表匹配到一个热点前缀时,就向第一处理节点进行发送该热点前缀的信息,也可以是第二处理节点定时(例如,以预设时间段为时间间隔)向第一节点发送相应周期内匹配到的热点前缀的信息。示例性地,该第二处理节点可以基于telemetry技术,定时向第一节点发送相应周期内匹配到的热点前缀的信息。
在该种可能的实现方式中,在进行基于最长前缀匹配原则进行匹配时,若前缀树中的任一子节点的前缀与报文的目的IP地址相匹配,则该子节点的父节点的前缀也必然与该报文的目的IP地址相匹配。而由于前缀树中的任一子节点对应的前缀相对于该子节点的父节点对应的前缀更长,因此,可以认为该子节点对应的前缀所包含的路由的信息越具体,从而更好地保证报文的准确转发。因此,可以根据第一前缀对应的前缀子树中子节点的前缀,确定热点前缀,此时,第一前缀对应的前缀子树中子节点的前缀可以在第一前缀的基础上包含相较于第一前缀较多的路由信息,此外若第一前缀为在预设时间段内被匹配的前缀甚至是匹配次数较多的前缀,则第一前缀对应的前缀子树中子节点的前缀也有较大可能为在后续可能被匹配到的前缀。示例性地,第一前缀对应的前缀子树中的子节点的前缀可以均作为目标前缀。或者,也可以根据各自对应的出端口,对每个第一前缀以及第一前缀对应的前缀子树中的子节点的前缀进行筛选,以获得目标前缀。
在第一方面的一种可能的实现方式中,上述步骤:若至少一个第一前缀在基于所有前缀所得到的前缀树中对应有前缀子树,则根据每个第一前缀,以及,第一前缀对应的前缀子树中的子节点的前缀,获得目标前缀,包括:若至少一个第一前缀在基于所有前缀所得 到的前缀树中对应有前缀子树,则将每个第一前缀,以及每个前缀子树中的目标子节点的前缀,确定为目标前缀,目标子节点与在相应前缀子树中的父节点对应有不同的出端口。
在该种可能的实现方式中,在进行基于最长前缀匹配原则进行匹配时,若前缀树中的任一子节点的前缀与报文的目的IP地址相匹配,则该子节点的父节点的前缀也必然与该报文的目的IP地址相匹配。而若该子节点对应的出端口与相应父节点对应的出端口相同,则任一匹配到该子节点的前缀的报文实际上也都可以基于与该子节点对应的父节点的前缀的匹配结果来确定该报文对应的目标出端口。可见,在实际匹配过程中,该子节点的匹配结果可以合并至对应的父节点的匹配结果中。因此,为了减少热点路由表的大小,并且降低前缀匹配时的计算量,该种可能的实现方式中,可以将第一前缀对应的前缀子树中,与相应父节点对应有不同的出端口的子节点作为目标前缀,而将第一前缀对应的前缀子树中,与相应父节点对应有相同的出端口的子节点则不作为目标前缀。
在第一方面的一种可能的实现方式中,上述步骤:根据第一处理节点存储的全局路由表,确定报文对应的目标出端口,以使得转发设备通过目标出端口对报文进行转发,包括:根据第一处理节点存储的全局路由表,确定报文对应的目标出端口;根据目标出端口和报文,获得反馈信息;向第二处理节点发送反馈信息,以使得第二处理节点根据反馈信息转发报文。
在该种可能的实现方式中,第一处理节点可以根据热点路由表实现对热点路由的快速转发。而第二处理节点可以为转发设备中的诸如CPU等信息处理设备。
然而,在实际使用过程中,通过转发设备中的CPU等信息处理设备进行报文转发可能存在以下两个问题:1、由于CPU等信息处理设备本身自带网卡的数量较少,导致CPU等信息处理设备对应的出端口的数量较为有限,能够实现的转发路由路径受限,因此,通过CPU等信息处理设备进行转发可能会存在CPU等信息处理设备找不到出端口的情况。2、CPU等信息处理设备中的网卡的传输速率一般也比较低,通过全局路由表进行查询的情况在一个时间段较为集中的时候,容易出现拥塞。
该种可能的实现方式中,为了避免CPU等信息处理设备转发报文所带来的以上两个问题,本申请实施例中,可以在确定报文对应的目标出端口之后,根据目标出端口和报文,获得反馈信息,并向第二处理节点发送反馈信息,以由第二处理节点根据反馈信息的目标字段中的目标出端口的信息,对报文进行转发。此时,由于诸如转发芯片等第二处理节点的网卡速率通常较高,能够承担较大的转发量并且转发速率较高,因此,通过诸如转发芯片等第二处理节点可以实现对报文的高速准确地转发操作。
在第一方面的一种可能的实现方式中,上述步骤:根据目标出端口和报文,获得反馈信息,包括:
在位于报文之前的目标字段中,写入目标出端口的信息,以获得反馈信息,反馈信息用于第二处理节点读取目标字段中的目标出端口的信息,并根据读取到的目标出端口的信息转发报文。
在该种可能的实现方式中,第二处理节点可以从反馈信息中快速地读取到报文对应的目标出端口的信息,以高效地对报文进行转发,而不需要做过多的数据查询以及对信息的过多处理操作,转发效率较高。
在第一方面的一种可能的实现方式中,第二处理节点为转发芯片,第一处理节点为中央处理器CPU。
在该种可能的实现方式中,转发芯片用于实现路由转发功能。CPU可以用于执行配置路由器、生成路由表、网络管理、报文的解析和处理等操作。CPU的具体配置在此不做限制。在一些示例中,CPU可以是多核处理器,其中,不同的核可以分别用于执行不同的功能,例如,CPU的某个核用于执行数据面的操作,以进行用户数据的处理和交互等操作,而CPU中的另一个核用于执行控制面的操作,以执行相应的操作系统的操作指令,例如执行配置转发协议,生成和维护热点路由表以及全局路由表等操作。
目前,处于功耗以及成本的考虑,转发芯片的内存一般不大,而随着路由器转发量越来越大,转发芯片的内存越来越不能满足实际需求。而该种可能的实现方式中,可以通过转发芯片的内存存储热点路由表,而不需要存储全局路由表,从而降低对转发芯片的内存容量的要求。此外,通常来说,CPU的计算资源以及存储资源明显优于转发芯片。该种可能的实现方式中,可以充分利用路由器中的CPU的内存等存储资源以及计算资源来进行全局路由表的存储以及非热点路由的匹配,而不需要在转发设备增加额外的硬件,减小了设备功耗以及硬件成本。
本申请第二方面提供一种转发报文的方法,该方法应用于转发设备中的第二处理节点,转发设备还包括第一处理节点,该方法包括:接收报文;在第二处理节点存储的热点路由表中,匹配报文对应的目标出端口;若在第二处理节点存储的热点路由表中未匹配到报文对应的目标出端口,则向第一处理节点发送报文的信息,以使得第一处理节点根据第一处理节点存储的全局路由表,确定报文对应的目标出端口,目标出端口用于转发设备通过目标出端口对报文进行转发。
上述第二方面中,若在第二处理节点存储的热点路由表中匹配到报文对应的目标出端口,则第二处理节点通过目标出端口对报文进行转发。这样,第二处理节点可以对热点路由进行快速地路由查询,而由于热点路由表所需的存储空间较少,对热点路由的查找效率较高,针对热点路由进行路由查找以及转发等处理操作对第二处理节点的数据处理能力的要求也较低,因此,第二处理节点可以以较低的功耗、存储资源和硬件成本,实现对热点路由的高效路由查询。
在第二方面的一种可能的实现方式中,该方法还包括:接收第一处理节点发送的反馈信息,反馈信息为第一处理节点在位于报文之前的目标字段中,写入目标出端口的信息而得到;读取反馈信息中目标字段的目标出端口的信息;根据读取到的目标出端口的信息转发报文。
在该种可能的实现方式中,将目标出端口的信息封装至位于报文之前的目标字段中,可以方便第二处理节点对该目标字段进行快速地读取,再根据反馈信息中的报文进行快速转发,转发流程简单高效。
本申请第三方面提供一种转发报文的装置,该装置应用于转发设备中的第一处理节点,转发设备还包括第二处理节点,该装置具有实现上述第一方面或第一方面任意一种可能实现方式的方法的功能。该功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。该硬件或软件包括一个或多个与上述功能相对应的模块,例如:接收模块和处理模块。
本申请第四方面提供一种第一处理节点,该第一处理节点包括至少一个处理器、存储器、通信接口以及存储在存储器中并可在处理器上运行的计算机执行指令,当计算机执行指令被处理器执行时,处理器执行如上述第一方面或第一方面任意一种可能的实现方式的方法。
本申请第五方面提供一种存储一个或多个计算机执行指令的计算机可读存储介质,当计算机执行指令被处理器执行时,处理器执行如上述第一方面或第一方面任意一种可能的实现方式的方法。
本申请第六方面提供一种存储一个或多个计算机执行指令的计算机程序产品,当计算机执行指令被处理器执行时,处理器执行如上述第一方面或第一方面任意一种可能的实现方式的方法。
本申请第七方面提供了一种芯片系统,该芯片系统包括处理器,用于支持控制设备实现上述第一方面或第一方面任意一种可能的实现方式中所涉及的功能。在一种可能的设计中,芯片系统还可以包括存储器,存储器用于保存控制设备必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件。
本申请第八方面提供一种转发报文的装置,该装置应用于转发设备中的第二处理节点,转发设备还包括第一处理节点,该装置具有实现上述第二方面或第二方面任意一种可能实现方式的方法的功能。该功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。该硬件或软件包括一个或多个与上述功能相对应的模块,例如:接收模块、匹配模块和发送模块。
本申请第九方面提供一种第二处理节点,该第二处理节点包括至少一个处理器、存储器、通信接口以及存储在存储器中并可在处理器上运行的计算机执行指令,当计算机执行指令被处理器执行时,处理器执行如上述第二方面或第二方面任意一种可能的实现方式的方法。
本申请第十方面提供一种存储一个或多个计算机执行指令的计算机可读存储介质,当计算机执行指令被处理器执行时,处理器执行如上述第二方面或第二方面任意一种可能的实现方式的方法。
本申请第十一方面提供一种存储一个或多个计算机执行指令的计算机程序产品,当计算机执行指令被处理器执行时,处理器执行如上述第二方面或第二方面任意一种可能的实现方式的方法。
本申请第十二方面提供了一种芯片系统,该芯片系统包括处理器,用于支持控制设备实现上述第二方面或第二方面任意一种可能的实现方式中所涉及的功能。在一种可能的设计中,芯片系统还可以包括存储器,存储器用于保存控制设备必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件。
本申请第十三方面提供了一种转发设备,该转发设备包括第一处理节点和第二处理节点,第一处理节点用于实现如上述第一方面或第一方面任意一种可能的实现方式的方法,第二处理节点用于实现如上述第二方面或第二方面任意一种可能的实现方式的方法。
其中,第三方面至第七方面或者其中任一种可能实现方式所带来的技术效果可参见第一方面或第一方面任意一种可能的实现方式所带来的技术效果,第八方面至第十二方面所 带来的技术效果可参见第二方面或者第二方面任意一种可能的实现方式所带来的技术效果,此处不再赘述。
附图说明
图1是本申请实施例提供的一种网络架构示意图;
图2是本申请实施例提供的转发报文的方法的一实施例示意图;
图3是本申请实施例提供的转发报文的方法的一实施例示意图;
图4a是本申请实施例提供的前缀树的一种示例性示意图;
图4b是本申请实施例提供的前缀子树的一种示例性示意图;
图5a是本申请实施例提供的前缀树的一种示例性示意图;
图5b是本申请实施例提供的前缀子树的一种示例性示意图;
图6是本申请实施例提供的转发报文的方法的一实施例示意图;
图7是本申请实施例提供的反馈信息的一种示例性结构示意图;
图8是本申请实施例提供的转发报文的装置的一实施例示意图;
图9是本申请实施例提供的转发报文的装置的一实施例示意图;
图10是本申请实施例提供的第一处理节点的一结构示意图;
图11是本申请实施例提供的第二处理节点的一结构示意图;
图12是本申请实施例提供的转发设备的一结构示意图。
具体实施方式
下面结合附图,对本申请的实施例进行描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。本领域普通技术人员可知,随着技术发展和新场景的出现,本申请实施例提供的技术方案对于类似的技术问题,同样适用。
本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。
本申请实施例提供一种转发报文的方法,用于解决目前的转发设备的转发量越来越大,路由表对应的存储需求也随之增大,导致转发设备中提供转发功能的转发芯片等硬件的存储压力以及路由查询压力较大,常常无法满足应用场景的需要的问题。本申请实施例还提供了相应的装置、计算机设备、计算机可读存储介质和计算机程序产品等。
在计算机网络中,通常需要通过转发设备进行设备间的信息转发。示例性地,转发设备可以为交换机(switch)、路由器(router)或者网关设备等。
如图1所示,为一种网络架构示意图。其中,终端设备与服务器之间的信息传输路径通常包括一个或多个转发设备。而本申请中的转发设备可以是图1中的路由器12或者交换 机13。
本申请实施例提供的转发报文的方法的一实施例可以应用于上述转发设备,下面结合附图对本申请实施例提供的转发报文的方法进行介绍。
本申请实施例中,该转发设备包括第一处理节点和第二处理节点。
第一处理节点和第二处理节点可以是转发设备中不同的物理模块,也可以是转发设备中不同的虚拟机或者不同的容器。
示例性地,第一处理节点可以为转发设备中的中央处理器(central processing unit,CPU)、现场可编程逻辑门阵列(field-programmable gate array,FPGA)或者其他具有数据分析功能的装置。第二处理节点可以为集成电路(application specific integrated circuit,ASIC)转发芯片,或网络处理器(network processor,NP)芯片等能够实现路由转发功能的转发芯片。
如图2所示,本申请实施例提供的转发报文的方法的一实施例包括:
201、第二处理节点接收报文。
该第二处理节点所接收的报文可以来自与该转发设备相连的其他转发设备,例如,其他路由转发设备或者其他交换机转发设备;也可以来自其他非转发设备,例如,来自业务网关、信令网关、安全网关、服务器以及终端设备等,具体此处不做限定。该报文可以直接由第二处理节点的输入端口从其他设备(如其他转发设备或者其他非转发设备)接收到,也可以是从转发设备中除第二处理节点之外的其他模块的输入端口接收到,再传递至第二处理节点。
报文的具体形式可以基于转发设备对应的传输协议来确定。示例性地,报文可以为传输控制协议(transmission control protocol,TCP)报文。
202、第二处理节点在第二处理节点存储的热点路由表中,匹配报文对应的目标出端口。
路由表(routing table)用于根据报文的目的IP地址,在转发设备中查找对应的出端口。本申请实施例中,路由表可以包括热点路由表和全局路由表。
其中,热点路由表可以包括但不限于转发设备在一定的时间段内进行报文转发时使用次数较多的出端口的相关信息。而全局路由表可以包括转发设备进行报文转发所对应的所有出端口的相关信息。示例性地,热点路由表可以存储于第二处理节点的内存等存储空间中,全局路由表可以存储于第一处理节点的内存等存储空间中。
热点路由表中所包含的具体信息以及第二处理节点匹配报文对应的目标出端口的方法可以基于转发设备进行路由查找所采用的原则来确定。
在一种示例中,转发设备基于最长前缀匹配(longest prefix match,LPM)原则来进行路由查找,则热点路由表包含转发设备对应的至少一个热点前缀和每个热点前缀对应的出端口的信息,全局路由表包括转发设备对应的所有前缀和每个前缀对应的出端口的信息,所有前缀包含至少一个热点前缀,报文是基于最长前缀匹配LPM原则在热点路由表和全局路由表中进行匹配的。
在另一种示例中,转发设备基于哈希查找算法来进行路由查找,则热点路由表以及全局路由表分别为哈希表的形式,该哈希表中可以包括基于预设地址得到的哈希值以及各个哈希值分别对应的出端口等信息。例如,可以基于该报文的目的IP地址和路由表对应的哈 希算法,计算该目的IP地址对应的哈希值,再根据该目的IP地址对应的哈希值在热点路由表中进行匹配,具体的匹配方式可以基于相应的哈希查找算法以及热点路由表的具体设置方式来确定,在此不做限制。
203、若在第二处理节点存储的热点路由表中未匹配到报文对应的目标出端口,则第二处理节点向第一处理节点发送报文的信息。
本申请实施例中,第二处理节点可以直接向第一处理节点发送报文,也可以只发送报文的目的IP地址的信息,还可以针对报文进行诸如封装等处理后,将封装有报文的数据包发送给第一处理节点。
在一些实施例中,若在第二处理节点存储的热点路由表中匹配到报文对应的目标出端口,则第二处理节点通过目标出端口对报文进行转发。这样,第二处理节点可以对热点路由进行高速转发,而由于热点路由表所需的存储空间较少,对热点路由的查找效率较高,针对热点路由进行路由查找以及转发等处理操作对第二处理节点的数据处理能力的要求也较低,因此,第二处理节点可以以较低的功耗、存储资源和硬件成本,实现对热点路由的高速转发。而由于热点路由通常是该转发设备的路由转发处理中使用较为频繁的路由,因此,在许多情况下,报文可以通过第二处理节点中的热点路由表,高效地匹配到对应的目标出端口,并通过第二处理节点进行高效地转发。
204、第一处理节点接收第二处理节点发送的报文的信息。
报文在第二处理节点存储的热点路由表中未匹配到对应的目标出端口。
205、第一处理节点根据第一处理节点存储的全局路由表,确定报文对应的目标出端口,以使得转发设备通过目标出端口对报文进行转发。
本申请实施例中,全局路由表可以包括转发设备进行报文转发所对应的所有出端口的相关信息。示例性地,全局路由表可以存储于第一处理节点的内存等存储空间中。
全局路由表中所包含的具体信息以及第一处理节点根据全局路由表匹配报文对应的目标出端口的方法可以基于转发设备进行路由查找所采用的原则来确定。例如,在一种示例中,全局路由表包括转发设备对应的所有前缀和每个前缀对应的出端口的信息,则报文是基于最长前缀匹配LPM原则在热点路由表和全局路由表中进行匹配的。在另一种示例中,转发设备基于哈希查找算法来进行路由查找,全局路由表为哈希表的形式,该哈希表中可以包括基于转发设备中每个出端口对应的IP地址得到的哈希值以及各个哈希值分别对应的出端口等信息。在实际应用中,可以基于该报文的目的IP地址和路由表对应的哈希算法,计算该目的IP地址对应的哈希值,再根据该目的IP地址对应的哈希值在热点路由表中进行匹配,具体的匹配方式可以基于相应的哈希查找算法以及全局路由表的具体设置方式来确定,在此不做限制。
在确定报文对应的目标出端口之后,可以由第一处理节点通过该目标出端口对该报文进行转发,也可以是由转发设备中除第一处理节点之外的其他节点(例如第二处理节点)对该报文进行转发。
本申请实施例中,第一处理节点可以根据第一处理节点存储的全局路由表,确定报文对应的目标出端口,以使得转发设备通过目标出端口对报文进行转发。这样,可以合理利用第一处理节点的存储资源和数据处理资源来匹配非热点路由信息,以提升转发设备的转 发性能。
在一些实施例中,第二处理节点为转发芯片,第一处理节点为中央处理器CPU。
转发芯片用于实现路由转发功能。示例性地,该转发芯片可以为集成电路(application specific integrated circuit,ASIC)转发芯片,或网络处理器(network processor,NP)芯片;当然,转发芯片还可以为其它类型的芯片,本申请对此并不作限制。
第一处理节点可以为转发设备中的中央处理器(central processing unit,CPU)。该CPU可以用于执行配置路由器、生成路由表、网络管理、报文的解析和处理等操作。CPU的具体配置在此不做限制。在一些示例中,CPU可以是多核处理器,其中,不同的核可以分别用于执行不同的功能,例如,CPU的某个核用于执行数据面的操作,以进行用户数据的处理和交互等操作,而CPU中的另一个核用于执行控制面的操作,以执行相应的操作系统的操作指令,例如执行配置转发协议,生成和维护热点路由表以及全局路由表等操作。
目前,处于功耗以及成本的考虑,转发芯片的内存一般不大,而随着路由器转发量越来越大,转发芯片的内存越来越不能满足实际需求。
当转发芯片本身的内存不能满足转发设备的转发量的需求时,通常是通过给转发芯片外扩内存的方式来扩展内存。具体地,给转发芯片外扩内存时,需要给转发芯片外接FPGA,再通过外接的FPGA外接诸如动态随机存取存储器(dynamic random access memory,DRAM)或者三态内容寻址存储器(ternary content addressable memory,TCAM)的存储器。这样,转发芯片需要通过外接的FPGA来控制该FPGA所外接的存储器的数据的存取。此时,由于外接的硬件较多,会导致硬件成本增加,此外,外接的FPGA以及存储器还会使得转发设备的功耗增加。
或者,目前,也可以通过外接的服务器来扩展转发芯片的数据存储能力。例如,转发芯片通过远程直接数据存取(remote direct memory access,RDMA)等技术,将接收到的报文转发至远程服务器,再通过远程服务器根据远程服务器中存储的路由表来查询该报文对应的出端口,然后根据对应的出端口从服务器对该报文进行转发。在这一方案中,报文需要在转发设备和服务器之间进行高速传输,信息传输的可靠性可能难以保证,并且需要远程服务器配置的网卡的性能较好,导致成本较高。
而本申请实施例中,可以通过转发芯片的内存存储热点路由表,而不需要存储全局路由表,从而降低对转发芯片的内存容量的要求。此外,通常来说,CPU的计算资源以及存储资源明显优于转发芯片。本申请实施例中,可以充分利用路由器中的CPU的内存等存储资源以及计算资源来进行全局路由表的存储以及非热点路由的匹配,而不需要在转发设备增加额外的硬件,减小了设备功耗以及硬件成本。
在一些实施例中,热点路由表包含转发设备对应的至少一个热点前缀和每个热点前缀对应的出端口的信息,全局路由表包括转发设备对应的所有前缀和每个前缀对应的出端口的信息,所有前缀包含至少一个热点前缀,报文是基于最长前缀匹配LPM原则在热点路由表和全局路由表中进行匹配的。
前缀可以通过由0和/或1,以及*组成的数组来表示,数组的最后一位为*,除最后一位之外的其他位为0或1。其中,*表示在进行最长前缀匹配时,该位不匹配。
基于最长前缀匹配LPM原则,每个出端口所对应的前缀可以基于出端口的IP地址以及 该IP地址对应的子网掩码来确定。具体地,可以将该IP地址对应的子网掩码的二进制网络位与该出端口的二进制的IP地址的相应位按位进行逻辑与运算,再将该逻辑与运算的结果作为该出端口对应的前缀。
以热点路由表为例,在一种示例中,在基于最长前缀匹配LPM原则进行匹配时,针对热点路由表中的每一个出端口,可以将报文对应的二进制目的IP地址与热点路由表中相应出端口所对应的子网掩码的二进制网络位进行逻辑与运算,若该逻辑与运算的结果与该出端口对应的热点前缀相同,则可以认为该出端口与该报文相匹配。然后,再从匹配的出端口中,选择对应的热点前缀最长的出端口作为该报文的目标出端口。
热点前缀为所有前缀中的一部分。从所有前缀中确定热点前缀的方式可以有多种,在此不做限制。示例性地,可以是用户从所有前缀中选择一个或多个前缀以作为热点前缀,也可以将指定时间段内匹配成功的次数达到指定次数的前缀作为热点前缀,还可以将指定时间段内匹配成功的次数达到指定次数的前缀的相关前缀作为热点前缀,其中,任一前缀的相关前缀可以是用户预先确定的,也可以根据任一前缀与相关前缀的相似度等来描述。
通过最长前缀匹配原则来进行确定报文对应的出端口,可以避免由于哈希查找算法的哈希冲突所导致的虚假匹配等情况,保证较好的路由查询准确性。
在一些实施例中,如图3,该方法还包括:
301、根据第一处理节点在预设时间段内通过全局路由表匹配成功的前缀,和/或,第二处理节点在预设时间段内通过热点路由表匹配成功的前缀,获得至少一个第一前缀。
302、若至少一个第一前缀在基于所有前缀所得到的前缀树中对应有前缀子树,则根据每个第一前缀,以及,第一前缀对应的前缀子树中的子节点的前缀,获得目标前缀,每个前缀子树的根节点与相应的第一前缀对应。
303、根据目标前缀以及目标前缀对应的出端口,重新确定热点路由表。
304、向第二处理节点发送重新确定的热点路由表。
上述步骤可以应用于第一处理节点。
下面针对上述步骤301-304进行具体介绍。
本申请实施例中,为了便于描述,将第一处理节点在预设时间段内通过全局路由表匹配成功的前缀称为第一匹配前缀,并将第二处理节点在预设时间段内通过热点路由表匹配成功的前缀称为第二匹配前缀。
本申请实施例中,第一处理节点可以采集第一处理节点在预设时间段内通过全局路由表匹配成功的前缀以及第二处理节点在预设时间段内通过热点路由表匹配成功的前缀的信息,也即是采集第一匹配前缀以及第二匹配前缀的信息,获得该预设时间段对应的匹配结果,该匹配结果可以包括第一匹配前缀,和/或,第二匹配前缀。
其中,可以是第一处理节点从第二处理节点主动获取第二匹配前缀,也可以是第二处理节点向第一处理节点主动发送第二匹配前缀的信息。该第二处理节点向第一处理节点主动发送第二匹配前缀的信息时,可以是第二处理节点每次通过热点路由表匹配到一个热点前缀时,就向第一处理节点进行发送该热点前缀的信息,也可以是第二处理节点定时(例如,以预设时间段为时间间隔)向第一节点发送相应周期内匹配到的热点前缀的信息。示例性地,该第二处理节点可以基于telemetry技术,定时向第一节点发送相应周期内匹配到的 热点前缀的信息。
本申请实施例中,可以将每个第一匹配前缀和每个第二匹配前缀都作为第一前缀,也可以基于预设时间段内每个第一匹配前缀和每个第二匹配前缀各自对应的匹配次数,和/或第二处理节点的内存大小,从第一匹配前缀和第二匹配前缀中进行筛选,以获得第一前缀。
例如,在一些示例中,可以根据第二处理节点的内存大小等条件,确定热点路由表中所能包含的路由信息的数量阈值,其中,每个路由信息对应一个前缀,每个路由信息包含相应的一个前缀与该前缀对应的出端口的信息。若第一匹配前缀和第二匹配前缀的总个数不大于该数量阈值,则将每个第一匹配前缀和每个第二匹配前缀都作为第一前缀。若第一匹配前缀和第二匹配前缀的总个数大于该数量阈值,则从各个第一匹配前缀和第二匹配前缀中,确定在该预设时间段内匹配次数大于预设次数的前缀,和/或,在预设时间段内匹配次数最多的前N个前缀为第一前缀。其中,N为正整数,且N的取值不大于该数量阈值。
在确定第一前缀之后,可以从第一前缀以及每个第一前缀所相关的其他前缀中,确定目标前缀。
具体地,若至少一个第一前缀在基于所有前缀所得到的前缀树中对应有前缀子树,则根据每个第一前缀,以及,第一前缀对应的前缀子树中的子节点的前缀,获得目标前缀。
其中,前缀树又称为trie树。前缀树可以是二叉树,也可以是多叉树。前缀树包括一个根节点,前缀树的根节点可以不包含字符,而前缀树的任一子节点的前缀相对于该子节点的父节点的前缀的差别在于该子节点的前缀,任一子节点的前缀比该子节点的父节点的前缀在尾部的“*”之前多出M位,而任一子节点的前缀中,除这多出的M位之外的其他位与该子节点的父节点的前缀相同。M的取值可以是1,也可以是其他正整数。此外,M也称为前缀树的步长(stride)。
前缀树中的各个节点与所有前缀中的各个前缀一一对应。需要说明的是,前缀树以及前缀子树等用于描述一种数据之间的关联关系,该关联关系可以通过树形的数据存储结构来表示。前缀树中的每个节点可以通过一一对应的前缀进行标识,也可以通过一一对应的编号进行标识。
本申请实施例中,若前缀树中的任一节点在前缀树中对应有子节点,则该节点在该前缀树中也对应有前缀子树,并且,该节点为相应的前缀子树的根节点。
在进行基于最长前缀匹配原则进行匹配时,若前缀树中的任一子节点的前缀与报文的目的IP地址相匹配,则该子节点的父节点的前缀也必然与该报文的目的IP地址相匹配。而由于前缀树中的任一子节点对应的前缀相对于该子节点的父节点对应的前缀更长,因此,可以认为该子节点对应的前缀所包含的路由的信息越具体,从而更好地保证报文的准确转发。因此,可以根据第一前缀对应的前缀子树中子节点的前缀,确定热点前缀,此时,第一前缀对应的前缀子树中子节点的前缀可以在第一前缀的基础上包含相较于第一前缀较多的路由信息,此外若第一前缀为在预设时间段内被匹配的前缀甚至是匹配次数较多的前缀,则第一前缀对应的前缀子树中子节点的前缀也有较大可能为在后续可能被匹配到的前缀。示例性地,第一前缀对应的前缀子树中的子节点的前缀可以均作为目标前缀。或者,也可以根据各自对应的出端口,对每个第一前缀以及第一前缀对应的前缀子树中的子节点的前 缀进行筛选,以获得目标前缀。
在一种示例中,如表1所示,为一种示例性的全局路由表。
表1:全局路由表
编号 前缀 出端口
S0 01* 出端口0
S1 011* 出端口3
S2 0110* 出端口2
S3 01101* 出端口10
S4 010* 出端口4
S5 0101* 出端口4
S6 01011* 出端口2
S7 0100* 出端口8
S8 01001* 出端口6
表1中,每个前缀不仅对应有出端口,还对应有编号,该编号可以用于标识对应的前缀。
如图4a所示,为表1的全局路由表对应的前缀树。图5a的前缀树中的各个节点与表1中的前缀一一对应。
如表2所示,为表1的全局路由表对应的一种示例性的热点路由表。
表2:热点路由表
编号 前缀 出端口
S2 0110* 出端口2
S3 01101* 出端口10
S4 010* 出端口4
S5 0101* 出端口4
S6 01011* 出端口2
S7 0100* 出端口8
S8 01001* 出端口6
该热点路由表中,不仅包括指定时间段内匹配成功的次数达到指定次数的前缀0110*和010*,还包括前缀0110*对应的子节点的前缀0101*,以及010*对应的子节点的前缀0101*、01011*、0100*、01001*。
如图4b所示,为表2的热点路由表对应的前缀子树。其中,具体包括前缀0110*对应的前缀子树以及前缀010*对应的前缀子树。
示例性地,第一处理节点可以以指定的周期,重复执行上述步骤301-304。此时,每个周期的时长可以为该预设时间段的时长。或者,也可以是响应于用户的指定操作而执行 上述步骤301-304。
在一些实施例中,若该重新确定的热点路由表与重新确定前的热点路由表不同,则执行上述步骤304,也就是向第二处理节点发送重新确定的热点路由表。而若该重新确定的热点路由表与重新确定前的热点路由表相同,则可以不执行上述步骤304,也就是不向第二处理节点发送该重新确定的热点路由表。
在一些实施例中,上述步骤302包括:
若至少一个第一前缀在基于所有前缀所得到的前缀树中对应有前缀子树,则将每个第一前缀,以及每个前缀子树中的目标子节点的前缀,确定为目标前缀,目标子节点与在相应前缀子树中的父节点对应有不同的出端口。
本申请实施例中,可以根据各自对应的出端口,对第一前缀所对应的前缀子树所对应的前缀进行筛选。
在进行基于最长前缀匹配原则进行匹配时,若前缀树中的任一子节点的前缀与报文的目的IP地址相匹配,则该子节点的父节点的前缀也必然与该报文的目的IP地址相匹配。而若该子节点对应的出端口与相应父节点对应的出端口相同,则任一匹配到该子节点的前缀的报文实际上也都可以基于与该子节点对应的父节点的前缀的匹配结果来确定该报文对应的目标出端口,可见,在实际匹配过程中,该子节点的匹配结果可以合并至对应的父节点的匹配结果中。因此,为了减少热点路由表的大小,并且降低前缀匹配时的计算量,本申请实施例中,可以将第一前缀对应的前缀子树中,与相应父节点对应有不同的出端口的子节点作为目标前缀,而将第一前缀对应的前缀子树中,与相应父节点对应有相同的出端口的子节点则不作为目标前缀。
示例性地,如表3所示,为一种示例性的全局路由表。
表3:全局路由表
编号 前缀 出端口
P0 01* 出端口0
P1 011* 出端口3
P2 0110* 出端口2
P3 01101* 出端口10
P4 010* 出端口4
P5 0101* 出端口4
P6 01011* 出端口2
P7 0100* 出端口8
P8 01001* 出端口6
P9 01100* 出端口2
P10 01000* 出端口4
如图5a所示,为表3的全局路由表对应的前缀树。
在如图5a所示的前缀树中,在某一时间段内,第一处理节点在预设时间段内通过全局路由表匹配成功的前缀以及第二处理节点在预设时间段内通过热点路由表匹配成功的前缀 为P2:0110*以及P4:010*。
针对P2,P2的前缀子树中的子节点包括P3:01101*和P9:01100*。其中,P3的出端口与P2不同,因此,P3也作为目标前缀。而P9的出端口与P2相同,则P9不作为目标前缀,而可以合并于与P2的前缀相匹配的情况中。
针对P4,P4:010*的前缀子树中子节点包括P5:0101*、P6:01011*、P7:0100*、P8:01001*和P10:01000*。其中,P5:0101*的出端口与其父节点P4相同,则不作为目标前缀。P6:01011*、P7:0100*、P8:01001*和P10:01000*的出端口与各自对应的父节点不同,则均作为目标前缀。
本示例中,根据目标前缀获得的热点路由表如表4所示。
表4:热点路由表
编号 前缀 出端口
P2 0110* 出端口2
P3 01101* 出端口10
P4 010* 出端口4
P6 01011* 出端口2
P7 0100* 出端口8
P8 01001* 出端口6
P10 01000* 出端口4
如图5b所示,为表4的热点路由表对应的前缀子树。
在一些实施例中,如图6所示,上述步骤205,包括:
601、第一处理节点根据第一处理节点存储的全局路由表,确定报文对应的目标出端口。
602、第一处理节点根据目标出端口和报文,获得反馈信息。
603、第一处理节点向第二处理节点发送反馈信息。
604、第二处理节点接收第一处理节点发送的反馈信息。
605、第二处理节点读取反馈信息中目标字段的目标出端口的信息。
606、第二处理节点根据读取到的目标出端口的信息转发报文。
下面针对上述步骤601-606进行具体介绍。
本申请实施例中,反馈信息的具体形式在此不做限制。示例性地,可以在报文之前增加包含该目标字段的指定的头部结构之后,将增加了该头部结构的报文进行封装。
例如,报文之前和/或报文之后还可以包括其他信息,例如,可以包括指定的报文头、该报文对应的虚拟局域网(virtual local area network,VLAN)的信息、该报文对应的目的IP地址的信息等。
本申请实施例中,第一处理节点可以根据热点路由表实现对热点路由的快速转发。而第二处理节点可以为转发设备中的诸如CPU等信息处理设备。
然而,在实际使用过程中,通过转发设备中的CPU等信息处理设备进行报文转发可能存在以下两个问题:
1、由于CPU等信息处理设备本身自带网卡的数量较少,导致CPU等信息处理设备对应 的出端口的数量较为有限,能够实现的转发路由路径受限,因此,通过CPU等信息处理设备进行转发可能会存在CPU等信息处理设备找不到出端口的情况。
2、CPU等信息处理设备中的网卡的传输速率一般也比较低,通过全局路由表进行查询的情况在一个时间段较为集中的时候,容易出现拥塞。
为了避免CPU等信息处理设备转发报文所带来的以上两个问题,本申请实施例中,可以在确定报文对应的目标出端口之后,根据目标出端口和报文,获得反馈信息,并向第二处理节点发送反馈信息,以由第二处理节点根据反馈信息的目标字段中的目标出端口的信息,对报文进行转发。此时,由于诸如转发芯片等第二处理节点的网卡速率通常较高,能够承担较大的转发量并且转发速率较高,因此,通过诸如转发芯片等第二处理节点可以实现对报文的高速准确地转发操作。
在一些实施例中,上述步骤:根据目标出端口和报文,获得反馈信息,包括:
在位于报文之前的目标字段中,写入目标出端口的信息,以获得反馈信息,反馈信息用于第二处理节点读取目标字段中的目标出端口的信息,并根据读取到的目标出端口的信息转发报文。
本申请实施例中,将目标出端口的信息封装至位于报文之前的目标字段中,可以方便第二处理节点对该目标字段进行快速地读取,再根据反馈信息中的报文进行快速转发,转发流程简单高效。
本申请实施例中,目标字段可以是由第一处理节点在接收到报文之后再增加到报文之前的,也可以是第二处理节点在向第一处理节点发送报文之前,就增加到报文之前的。
目标字段的位数可以是预先固定的,也可以基于目标出端口的信息的大小而变化。此外,在一些示例中,报文之前还可以包括除目标出端口的信息之外的其他内容。例如,反馈信息的一种示例性结构如图7所示。
在图7所示的示例中,反馈信息从头部开始,可以依次包括用于标识起始位置的头部标识,报文的虚拟局域网(virtual local area network,VLAN)的信息、报文对应的目的IP地址、报文的目标出端口的信息以及报文的内容信息等。
若将报文之前的所有字段对应的结构称为反馈信息的头部结构,则在一种示例中,该头部结构可以是由第一处理节点增加至接收到的报文之前的。而在另一种示例中,可以是有第二处理节点在热点路由表中未匹配到对应的目标出端口时,增加到报文之前,再将增加有头部结构的报文发送至第一处理节点,在第一处理节点根据第一处理节点存储的全局路由表,确定报文对应的目标出端口之后,将目标出端口的信息写入头部结构中的目标字段,获得反馈信息,再向第二处理节点发送反馈信息。
通过本申请实施例,第二处理节点可以从反馈信息中快速地读取到报文对应的目标出端口的信息,以高效地对报文进行转发,而不需要做过多的数据查询以及对信息的过多处理操作,转发效率较高。
以上,本申请实施例从多个方面介绍了转发报文的方法,下面结合附图,介绍本申请的应用于转发设备的第一处理节点的转发报文的装置,以及应用于转发设备的第二处理节点的转发报文的装置。
如图8所示,本申请实施例提供一种转发报文的装置800,该装置800可以应用于转 发设备的第一处理节点。
该装置800的一实施例包括:
接收模块801,用于接收第二处理节点发送的报文的信息,报文在第二处理节点存储的热点路由表中未匹配到对应的目标出端口;
处理模块802,用于根据第一处理节点存储的全局路由表,确定报文对应的目标出端口,以使得转发设备通过目标出端口对报文进行转发。
可选地,热点路由表包含转发设备对应的至少一个热点前缀和每个热点前缀对应的出端口的信息,全局路由表包括转发设备对应的所有前缀和每个前缀对应的出端口的信息,所有前缀包含至少一个热点前缀,报文是基于最长前缀匹配LPM原则在热点路由表和全局路由表中进行匹配的。
可选地,处理模块802还用于:
根据第一处理节点在预设时间段内通过全局路由表匹配成功的前缀,和/或,第二处理节点在预设时间段内通过热点路由表匹配成功的前缀,获得至少一个第一前缀;
若至少一个第一前缀在基于所有前缀所得到的前缀树中对应有前缀子树,则根据每个第一前缀,以及,第一前缀对应的前缀子树中的子节点的前缀,获得目标前缀,每个前缀子树的根节点与相应的第一前缀对应;
根据目标前缀以及目标前缀对应的出端口,重新确定热点路由表;
向第二处理节点发送重新确定的热点路由表。
可选地,处理模块802用于:
若至少一个第一前缀在基于所有前缀所得到的前缀树中对应有前缀子树,则将每个第一前缀,以及每个前缀子树中的目标子节点的前缀,确定为目标前缀,目标子节点与在相应前缀子树中的父节点对应有不同的出端口。
可选地,处理模块802用于:
根据第一处理节点存储的全局路由表,确定报文对应的目标出端口;
根据目标出端口和报文,获得反馈信息;
向第二处理节点发送反馈信息,以使得第二处理节点根据反馈信息转发报文。
可选地,处理模块802用于:
在位于报文之前的目标字段中,写入目标出端口的信息,以获得反馈信息,反馈信息用于第二处理节点读取目标字段中的目标出端口的信息,并根据读取到的目标出端口的信息转发报文。
如图9所示,本申请实施例提供一种转发报文的装置900,该装置900可以应用于转发设备的第二处理节点。
该装置900的一实施例包括:
接收模块901,用于接收报文;
匹配模块902,用于在第二处理节点存储的热点路由表中,匹配报文对应的目标出端口;
发送模块903,用于若在第二处理节点存储的热点路由表中未匹配到报文对应的目标出端口,则向第二处理节点发送报文的信息,以使得第二处理节点根据第二处理节点存储 的全局路由表,确定报文对应的目标出端口,目标出端口用于转发设备通过目标出端口对报文进行转发。
可选地,装置900还包括读取模块904和转发模块905;
接收模块901还用于:接收第一处理节点发送的反馈信息,反馈信息为第一处理节点在位于报文之前的目标字段中,写入目标出端口的信息而得到;
读取模块904用于:读取反馈信息中目标字段的目标出端口的信息;
转发模块905用于:根据读取到的目标出端口的信息转发报文。
图10所示,是本申请实施例提供的第一处理节点1000的一种可能的逻辑结构示意图。该第一处理节点1000包括:存储器1001、处理器1002、通信接口1003以及总线1004。其中,存储器1001、处理器1002、通信接口1003通过总线1004实现彼此之间的通信连接。
存储器1001可以是只读存储器(Read Only Memory,ROM)、静态存储设备、动态存储设备或者随机存取存储器(Random Access Memory,RAM)。存储器1001可以存储程序,当存储器1001中存储的程序被处理器1002执行时,处理器1002和通信接口1003用于执行上述的转发报文的方法实施例的步骤204、205、301-304、601-603等。
处理器1002可以采用中央处理器(Central Processing Unit,CPU)、微处理器、应用专用集成电路(Application Specific Integrated Circuit,ASIC)、图形处理器(graphics processing unit,GPU)、数字信号处理器(Digital Signal Processing,DSP)、专用集成电路(ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件或者其任意组合,用于执行相关程序,以实现上述实施例中应用于第一处理节点的转发报文的装置中的接收模块、处理模块等所需执行的功能,或者执行本申请方法实施例的转发报文的方法实施例的步骤204、205、301-304、601-603等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器1001,处理器1002读取存储器1001中的信息,结合其硬件执行上述的转发报文的方法实施例的步骤204、205、301-304、601-603等。
通信接口1003使用例如但不限于收发器一类的收发装置,来实现第一处理节点1000与其他设备或通信网络之间的通信。例如,可以通过通信接口1003与第二处理节点进行信息交互。
总线1004可实现在第一处理节点1000各个部件(例如,存储器1001、处理器1002以及通信接口1003)之间传送信息的通路。总线1004可以是外设部件互连标准(Peripheral Component Interconnect,PCI)总线或扩展工业标准结构(Extended Industry Standard Architecture,EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,图10中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
在本申请的另一实施例中,还提供一种计算机可读存储介质,计算机可读存储介质中存储有计算机执行指令,当设备的处理器执行该计算机执行指令时,设备执行上述图10中的处理器所执行的步骤。
在本申请的另一实施例中,还提供一种计算机程序产品,该计算机程序产品包括计算机执行指令,该计算机执行指令存储在计算机可读存储介质中;当设备的处理器执行该计算机执行指令时,设备执行上述图10中的处理器所执行的步骤。
在本申请的另一实施例中,还提供一种芯片系统,该芯片系统包括处理器,该处理器用于实现上述图10的处理器所执行的步骤。在一种可能的设计中,芯片系统还可以包括存储器,存储器,用于保存数据写入的装置必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件。
图11所示,是本申请实施例提供的第二处理节点1100的一种可能的逻辑结构示意图。该第二处理节点1100包括:存储器1101、处理器1102、通信接口1103以及总线1104。其中,存储器1101、处理器1102、通信接口1103通过总线1104实现彼此之间的通信连接。
存储器1101可以是只读存储器(Read Only Memory,ROM)、静态存储设备、动态存储设备或者随机存取存储器(Random Access Memory,RAM)。存储器1101可以存储程序,当存储器1101中存储的程序被处理器1102执行时,处理器1102和通信接口1103用于执行上述的转发报文的方法实施例的步骤201-203、604-606等。
处理器1102可以采用中央处理器(Central Processing Unit,CPU)、微处理器、应用专用集成电路(Application Specific Integrated Circuit,ASIC)、图形处理器(graphics processing unit,GPU)、数字信号处理器(Digital Signal Processing,DSP)、专用集成电路(ASIC)、现成可编程门阵列(Field Programmable Gate Array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件或者其任意组合,用于执行相关程序,以实现上述实施例应用于第二处理节点的转发报文的装置中的接收模块、匹配模块以及发送模块等所需执行的功能,或者执行本申请方法实施例的转发报文的方法实施例的步骤201-203、604-606等。结合本申请实施例所公开的方法的步骤可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器1101,处理器1102读取存储器1101中的信息,结合其硬件执行上述的转发报文的方法实施例的步骤201-203、604-606等。
通信接口1103使用例如但不限于收发器一类的收发装置,来实现第二处理节点1100与其他设备或通信网络之间的通信。例如,可以与第一处理节点、终端设备、其他转发设备或者服务器等进行信息交互。
总线1104可实现在第二处理节点1100各个部件(例如,存储器1101、处理器1102以及通信接口1103)之间传送信息的通路。总线1104可以是外设部件互连标准(Peripheral Component Interconnect,PCI)总线或扩展工业标准结构(Extended Industry Standard Architecture,EISA)总线等。总线可以分为地址总线、数据总线、控制总线等。为便于表示,图11中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。
在本申请的另一实施例中,还提供一种计算机可读存储介质,计算机可读存储介质中存储有计算机执行指令,当设备的处理器执行该计算机执行指令时,设备执行上述图11中的处理器所执行的步骤。
在本申请的另一实施例中,还提供一种计算机程序产品,该计算机程序产品包括计算机执行指令,该计算机执行指令存储在计算机可读存储介质中;当设备的处理器执行该计算机执行指令时,设备执行上述图11中的处理器所执行的步骤。
在本申请的另一实施例中,还提供一种芯片系统,该芯片系统包括处理器,该处理器用于实现上述图11的处理器所执行的步骤。在一种可能的设计中,芯片系统还可以包括存储器,存储器,用于保存数据写入的装置必要的程序指令和数据。该芯片系统,可以由芯片构成,也可以包含芯片和其他分立器件。
在本申请的另一实施例中,如图12所示,还提供一种转发设备1200,转发设备1200包第一处理节点1000和第二处理节点1100。
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请实施例的范围。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请实施例所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请实施例各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。
功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请实施例各个实施例方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。
以上,仅为本申请实施例的具体实施方式,但本申请实施例的保护范围并不局限于此。

Claims (22)

  1. 一种转发报文的方法,其特征在于,应用于转发设备中的第一处理节点,所述转发设备还包括第二处理节点,所述方法包括:
    接收第二处理节点发送的报文的信息,所述报文在所述第二处理节点存储的热点路由表中未匹配到对应的目标出端口;
    根据所述第一处理节点存储的全局路由表,确定所述报文对应的目标出端口,以使得所述转发设备通过所述目标出端口对所述报文进行转发。
  2. 根据权利要求1所述的方法,其特征在于,所述热点路由表包含所述转发设备对应的至少一个热点前缀和每个所述热点前缀对应的出端口的信息,所述全局路由表包括所述转发设备对应的所有前缀和每个所述前缀对应的出端口的信息,所述所有前缀包含所述至少一个热点前缀,所述报文是基于最长前缀匹配LPM原则在所述热点路由表和所述全局路由表中进行匹配的。
  3. 根据权利要求2所述的方法,其特征在于,所述方法还包括:
    根据所述第一处理节点在预设时间段内通过所述全局路由表匹配成功的前缀,和/或,所述第二处理节点在所述预设时间段内通过所述热点路由表匹配成功的前缀,获得至少一个第一前缀;
    若至少一个所述第一前缀在基于所述所有前缀所得到的前缀树中对应有前缀子树,则根据每个所述第一前缀,以及,所述第一前缀对应的前缀子树中的子节点的前缀,获得目标前缀,每个所述前缀子树的根节点与相应的第一前缀对应;
    根据所述目标前缀以及所述目标前缀对应的出端口,重新确定所述热点路由表;
    向所述第二处理节点发送重新确定的所述热点路由表。
  4. 根据权利要求3所述的方法,所述若至少一个所述第一前缀在基于所述所有前缀所得到的前缀树中对应有前缀子树,则根据每个所述第一前缀,以及,所述第一前缀对应的前缀子树中的子节点的前缀,获得目标前缀,包括:
    若至少一个所述第一前缀在基于所述所有前缀所得到的前缀树中对应有前缀子树,则将每个所述第一前缀,以及每个所述前缀子树中的目标子节点的前缀,确定为所述目标前缀,所述目标子节点与在相应前缀子树中的父节点对应有不同的出端口。
  5. 根据权利要求1-4任一项所述的方法,其特征在于,所述根据所述第一处理节点存储的全局路由表,确定所述报文对应的目标出端口,以使得所述转发设备通过所述目标出端口对所述报文进行转发,包括:
    根据所述第一处理节点存储的全局路由表,确定所述报文对应的目标出端口;
    根据所述目标出端口和所述报文,获得反馈信息;
    向所述第二处理节点发送所述反馈信息,以使得所述第二处理节点根据所述反馈信息转发所述报文。
  6. 根据权利要求5所述的方法,其特征在于,所述根据所述目标出端口和所述报文,获得反馈信息,包括:
    在位于所述报文之前的目标字段中,写入所述目标出端口的信息,以获得所述反馈信息,所述反馈信息用于所述第二处理节点读取所述目标字段中的目标出端口的信息,并根据读取到的所述目标出端口的信息转发所述报文。
  7. 根据权利要求1-6任一项所述的方法,其特征在于,所述第二处理节点为转发芯片,所述第一处理节点为中央处理器CPU。
  8. 一种转发报文的方法,其特征在于,应用于转发设备中的第二处理节点,所述转发设备还包括第一处理节点,所述方法包括:
    接收报文;
    在所述第二处理节点存储的热点路由表中,匹配所述报文对应的目标出端口;
    若在所述第二处理节点存储的热点路由表中未匹配到所述报文对应的目标出端口,则向所述第一处理节点发送所述报文的信息,以使得所述第一处理节点根据所述第一处理节点存储的全局路由表,确定所述报文对应的目标出端口,所述目标出端口用于所述转发设备通过所述目标出端口对所述报文进行转发。
  9. 根据权利要求8所述的方法,其特征在于,还包括:
    接收所述第一处理节点发送的反馈信息,所述反馈信息为所述第一处理节点在位于所述报文之前的目标字段中,写入所述目标出端口的信息而得到;
    读取所述反馈信息中所述目标字段的目标出端口的信息;
    根据读取到的所述目标出端口的信息转发所述报文。
  10. 一种转发报文的装置,其特征在于,应用于转发设备中的第一处理节点,所述转发设备还包括第二处理节点,所述装置包括:
    接收模块,用于接收第二处理节点发送的报文的信息,所述报文在所述第二处理节点存储的热点路由表中未匹配到对应的目标出端口;
    处理模块,用于根据所述第一处理节点存储的全局路由表,确定所述报文对应的目标出端口,以使得所述转发设备通过所述目标出端口对所述报文进行转发。
  11. 根据权利要求10所述的装置,其特征在于,所述热点路由表包含所述转发设备对应的至少一个热点前缀和每个所述热点前缀对应的出端口的信息,所述全局路由表包括所述转发设备对应的所有前缀和每个所述前缀对应的出端口的信息,所述所有前缀包含所述至少一个热点前缀,所述报文是基于最长前缀匹配LPM原则在所述热点路由表和所述全局路由表中进行匹配的。
  12. 根据权利要求11所述的装置,其特征在于,
    所述处理模块还用于:
    根据所述第一处理节点在预设时间段内通过所述全局路由表匹配成功的前缀,和/或,所述第二处理节点在所述预设时间段内通过所述热点路由表匹配成功的前缀,获得至少一个第一前缀;
    若至少一个所述第一前缀在基于所述所有前缀所得到的前缀树中对应有前缀子树,则根据每个所述第一前缀,以及,所述第一前缀对应的前缀子树中的子节点的前缀,获得目标前缀,每个所述前缀子树的根节点与相应的第一前缀对应;
    根据所述目标前缀以及所述目标前缀对应的出端口,重新确定所述热点路由表;
    向所述第二处理节点发送重新确定的所述热点路由表。
  13. 根据权利要求12所述的装置,其特征在于,
    所述处理模块用于:
    若至少一个所述第一前缀在基于所述所有前缀所得到的前缀树中对应有前缀子树,则将每个所述第一前缀,以及每个所述前缀子树中的目标子节点的前缀,确定为所述目标前缀,所述目标子节点与在相应前缀子树中的父节点对应有不同的出端口。
  14. 根据权利要求10-13任一项所述的装置,其特征在于,
    所述处理模块用于:
    根据所述第一处理节点存储的全局路由表,确定所述报文对应的目标出端口;
    根据所述目标出端口和所述报文,获得反馈信息;
    向所述第二处理节点发送所述反馈信息,以使得所述第二处理节点根据所述反馈信息转发所述报文。
  15. 根据权利要求14所述的装置,其特征在于,
    所述处理模块用于:
    在位于所述报文之前的目标字段中,写入所述目标出端口的信息,以获得所述反馈信息,所述反馈信息用于所述第二处理节点读取所述目标字段中的目标出端口的信息,并根据读取到的所述目标出端口的信息转发所述报文。
  16. 一种转发报文的装置,其特征在于,应用于转发设备中的第二处理节点,所述转发设备还包括第一处理节点,所述装置包括:
    接收模块,用于接收报文;
    匹配模块,用于在所述第二处理节点存储的热点路由表中,匹配所述报文对应的目标出端口;
    发送模块,用于若在所述第二处理节点存储的热点路由表中未匹配到所述报文对应的目标出端口,则向所述第二处理节点发送所述报文的信息,以使得所述第二处理节点根据所述第二处理节点存储的全局路由表,确定所述报文对应的目标出端口,所述目标出端口 用于所述转发设备通过所述目标出端口对所述报文进行转发。
  17. 根据权利要求16所述的装置,其特征在于,所述装置还包括读取模块和转发模块;
    所述接收模块还用于:接收所述第一处理节点发送的反馈信息,所述反馈信息为所述第一处理节点在位于所述报文之前的目标字段中,写入所述目标出端口的信息而得到;
    所述读取模块用于:读取所述反馈信息中所述目标字段的目标出端口的信息;
    所述转发模块用于:根据读取到的所述目标出端口的信息转发所述报文。
  18. 一种第一处理节点,其特征在于,所述第一处理节点包括至少一个处理器、存储器及存储在所述存储器上并可被所述至少一个处理器执行的指令,所述至少一个处理器执行所述指令,以实现权利要求1至7中任一项所述的方法的步骤。
  19. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该计算机程序被处理器执行时实现权利要求1至7中任一项所述的方法。
  20. 一种第二处理节点,其特征在于,所述第一处理节点包括至少一个处理器、存储器及存储在所述存储器上并可被所述至少一个处理器执行的指令,所述至少一个处理器执行所述指令,以实现权利要求8或9所述的方法的步骤。
  21. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,该计算机程序被处理器执行时实现权利要求8或9所述的方法。
  22. 一种转发设备,其特征在于,所述转发设备包括第一处理节点和第二处理节点,所述第一处理节点用于实现权利要求1-7任一项所述的方法,所述第二处理节点用于实现权利要求8或9所述的方法。
PCT/CN2022/131859 2021-11-17 2022-11-15 转发报文的方法以及相关设备 WO2023088226A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111373018.2A CN116137606A (zh) 2021-11-17 2021-11-17 转发报文的方法以及相关设备
CN202111373018.2 2021-11-17

Publications (1)

Publication Number Publication Date
WO2023088226A1 true WO2023088226A1 (zh) 2023-05-25

Family

ID=86332732

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/131859 WO2023088226A1 (zh) 2021-11-17 2022-11-15 转发报文的方法以及相关设备

Country Status (2)

Country Link
CN (1) CN116137606A (zh)
WO (1) WO2023088226A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101273590A (zh) * 2005-12-29 2008-09-24 中兴通讯股份有限公司 报文快速转发方法和系统
CN102571613A (zh) * 2012-03-09 2012-07-11 华为技术有限公司 一种转发报文的方法及网络设备
CN105099921A (zh) * 2015-05-29 2015-11-25 杭州华三通信技术有限公司 一种基于用户的快速业务处理方法以及装置
CN106330715A (zh) * 2015-06-30 2017-01-11 杭州华三通信技术有限公司 报文处理方法及装置
US20200044953A1 (en) * 2018-08-02 2020-02-06 Shi Jin Chen Data Packet Fast Routing Method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101273590A (zh) * 2005-12-29 2008-09-24 中兴通讯股份有限公司 报文快速转发方法和系统
CN102571613A (zh) * 2012-03-09 2012-07-11 华为技术有限公司 一种转发报文的方法及网络设备
CN105099921A (zh) * 2015-05-29 2015-11-25 杭州华三通信技术有限公司 一种基于用户的快速业务处理方法以及装置
CN106330715A (zh) * 2015-06-30 2017-01-11 杭州华三通信技术有限公司 报文处理方法及装置
US20200044953A1 (en) * 2018-08-02 2020-02-06 Shi Jin Chen Data Packet Fast Routing Method

Also Published As

Publication number Publication date
CN116137606A (zh) 2023-05-19

Similar Documents

Publication Publication Date Title
EP3738277B1 (en) Segment routing network processing of packets
WO2021056945A1 (zh) 一种在sr网络中转发报文的方法、设备和系统
US20210320863A1 (en) Packet processing method, apparatus, and device, and packet forwarding method, apparatus, and device
WO2016192686A1 (zh) 数据报文转发
JP7479489B2 (ja) パケット送信方法、デバイス、およびシステム
WO2019185051A1 (zh) 一种基于集成流表转发报文的方法及装置
CN107547407B (zh) 报文传输方法、装置和实现装置
CN109921995B (zh) 一种配置地址表的方法、fpga和应用该fpga的网络设备
WO2021043232A1 (zh) 主机网络性能需求可编程化的方法、设备和系统
EP4009596A1 (en) Message forwarding method, device, and system in sr network
WO2017190559A1 (zh) 路由查找方法、装置、分配节点、查找节点及入口节点
WO2020093737A1 (zh) 一种报文处理方法及装置、存储介质、光网络终端
WO2022222750A1 (zh) 报文转发方法、装置、网络设备及存储介质
KR102579060B1 (ko) 라우팅 정보 전송 방법, 패킷 전송 방법 및 관련 장치
WO2023088226A1 (zh) 转发报文的方法以及相关设备
CN116319535A (zh) 路径切换方法、装置、网络设备、以及网络系统
CN111770049B (zh) 全局缓存变量及报文信息存储方法及装置
CN112019417B (zh) 传输报文的方法与设备
KR20230022251A (ko) Bier oam 검출 방법, 디바이스, 및 시스템
WO2023088145A1 (zh) 一种报文处理方法、装置及设备
US11882039B1 (en) UDF-based traffic offloading methods and systems
WO2023078144A1 (zh) 报文处理方法、装置及系统
US11831547B2 (en) BIERV6 packet forwarding method, device, and system
WO2023216622A1 (zh) 报文处理方法、设备、系统及计算机可读存储介质
CN112910783B (zh) 一种报文转发方法、装置及分布式设备

Legal Events

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

Ref document number: 22894760

Country of ref document: EP

Kind code of ref document: A1