WO2016106506A1 - Routing method and device - Google Patents

Routing method and device Download PDF

Info

Publication number
WO2016106506A1
WO2016106506A1 PCT/CN2014/095351 CN2014095351W WO2016106506A1 WO 2016106506 A1 WO2016106506 A1 WO 2016106506A1 CN 2014095351 W CN2014095351 W CN 2014095351W WO 2016106506 A1 WO2016106506 A1 WO 2016106506A1
Authority
WO
WIPO (PCT)
Prior art keywords
entry
address
matching
data packet
destination address
Prior art date
Application number
PCT/CN2014/095351
Other languages
French (fr)
Chinese (zh)
Inventor
胡农达
冯强
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2014/095351 priority Critical patent/WO2016106506A1/en
Priority to CN201480037879.5A priority patent/CN106170956B/en
Publication of WO2016106506A1 publication Critical patent/WO2016106506A1/en

Links

Images

Definitions

  • the present invention relates to the field of Internet information services, and in particular, to a table lookup routing method and device.
  • packet-switched technology also known as "packet switching”
  • packet switching when communication is performed between host nodes, communication data is first segmented and encapsulated in a single data packet at the source host node, and injected into the network, and then transmitted and routed through the network device for transmission, and finally the data packet arrives at the destination.
  • the host node is restored and merged into the original communication data.
  • network devices such as switches and routers, independently route and forward each data packet, that is, when a data packet arrives at the input port of the network device, the network device based on the address information in the data packet, such as the destination.
  • the MAC address or destination IP address determines the output port of the packet and switches the packet from the input port to the output port.
  • routing the process of "determining the output port of a packet” is referred to as “routing,” and the process of "switching a packet from an input port to an output port” is referred to as “forwarding.”
  • routing of data packets is performed by looking up a table: one or more logical “lookup tables”, also called “routing tables” (such as MAC forwarding tables) or IP routing table), each table contains one or more table entries, each table entry contains information such as address matching information and output port; matching by extracting the address information in the data packet and the address information in the table entry to determine Match the table entries and extract the output port information from the matching table entries to determine the output port.
  • This type of routing is called “table lookup routing.”
  • table lookup routing has a wide range of uses.
  • a learned forwarding table is stored in the switch, and the table entry includes information such as a MAC address and an output port number.
  • the switch receives a data packet, it extracts the destination MAC address from the data packet and compares it with the MAC address of the table entry in the forwarding table to determine the matching table entry (the destination MAC address and the MAC address in the table entry). Equal) to get the output port number.
  • the router also performs a similar lookup table routing mechanism: in each router, a lookup table (routing table) learned through a routing protocol is stored, and the table entry of the lookup table includes the network identifier, the network mask, and the output. Information such as port number and next hop network identifier.
  • a lookup table learned through a routing protocol
  • the table entry of the lookup table includes the network identifier, the network mask, and the output.
  • Information such as port number and next hop network identifier.
  • the performance of lookup table routing is usually the bottleneck of its performance, and the size of the lookup table is a determining factor in the performance of the table lookup and a key factor in the cost of the network device.
  • the larger the lookup table the slower the lookup table, and the more power consumed by the lookup process.
  • the larger the lookup table the more on-chip or off-chip storage is required, which in turn requires the device to have large on-chip or off-chip storage capacity. Because storage capacity, especially on-chip storage capacity, is very expensive, it can significantly increase network equipment costs. More importantly, for a given network device, the on-chip or off-chip storage capacity it has is limited, so the supported table capacity is limited.
  • the table size exceeds the table capacity, some of the table entries are lost, causing the route to fail. Because the table size is positively related to the size of the network, the size of the table also affects the maximum size of the network that the network device can build. Therefore, new technologies need to be developed to solve this problem.
  • the embodiment of the present invention provides a routing method and device, which improves the aggregation capability of a lookup table entry, thereby reducing the size of the lookup table.
  • an embodiment of the present invention provides a routing method, including:
  • Determining, in the routing table, a matching entry corresponding to the destination address, wherein the entry of the routing table includes an address operator and a network identifier, and a valid bit of the network identifier of the matching entry and a valid bit of the destination address The logical operation result of the operation according to the address operator of the matching entry is true;
  • the data packet is transmitted from an output port determined according to output port information in the matching entry.
  • the valid bit of the network identifier is an overall value that is used as the network identifier, and the valid bit of the destination address refers to the destination address. An overall value.
  • the entry of the routing table further includes a mask, where a valid bit of the destination address is the destination address and the location
  • the mask bit and the result of the operation are an overall value
  • the valid bit of the network identifier is an overall value of the network identifier and the result of the mask bit and operation.
  • the mask includes a continuous mask and a non-continuous mask.
  • the entry of the routing table further includes priority information, where the priority information is used to indicate a priority of the belonging entry ;
  • Determining, in the routing table, a matching entry corresponding to the destination address comprising: a logic for finding a valid bit of the network identifier of the entry in the routing table and a valid bit of the destination address according to an address operator of the entry
  • the operation result is an entry, and according to the priority information of the found entry, the entry with the highest priority is selected from the searched entry as the matching entry.
  • the determining, in the routing table, a matching entry corresponding to the destination address including: following a priority from high to low The order in which the logical bit of the network identifier of the entry is found in the routing table and the valid bit of the destination address is logically operated according to the address operator of the entry, and the first entry found is taken as The matching entry, wherein the entries of the lookup table are sorted according to priority.
  • the sending, by the output port determined according to the output port information in the matching entry, the data packet comprises: according to an address Determining, by the operation result of the output port information in the matching entry, the output port, and transmitting the data packet from the output port, where the address information includes at least one of the following: the destination address, The source address of the data packet, the network identifier of the matching entry, and the current node address.
  • the sending, by the output port determined according to the output port information in the matching entry, the data packet includes: according to The hash algorithm selects one of the plurality of ports recorded in the output port information as the output port, and forwards the data packet from the output port.
  • the matching entry further includes operation information, where the operation information is used to indicate that the data packet is operated, according to Before the output port determined by the output port information in the matching entry forwards and sends the data packet, the method further includes: operating the data packet according to the operation information in the matching entry.
  • the address operator includes: not equal to, greater than, less than, greater than or equal to, or less than or equal to.
  • an embodiment of the present invention provides a routing method, including:
  • the address information includes at least one of the following: The address, the source address of the data packet, the network identifier of the matching entry, and the current node address.
  • an entry of the routing table includes an address operator and a network identifier, where a valid bit of the network identifier of the matching entry and a valid bit of the destination address are in accordance with The result of the logical operation of the address operator of the matching entry is true.
  • the valid bit of the network identifier is an overall value that is used as the network identifier, and a valid bit of the destination address It refers to the overall value of the destination address.
  • the entry of the routing table further includes a mask, where a valid bit of the destination address is the destination address and location
  • the mask bit and the result of the operation are an overall value
  • the valid bit of the network identifier is an overall value of the network identifier and the result of the mask bit and operation.
  • the mask includes a continuous mask and a non-continuous mask.
  • the entry of the routing table further includes priority information, where the priority information is used to indicate a priority of the belonging entry ;
  • Determining, in the routing table, a matching entry corresponding to the destination address comprising: a logic for finding a valid bit of the network identifier of the entry in the routing table and a valid bit of the destination address according to an address operator of the entry
  • the operation result is an entry, and according to the priority information of the found entry, the entry with the highest priority is selected from the searched entry as the matching entry.
  • the determining, in the routing table, a matching entry corresponding to the destination address including: following a priority from high to low The order of finding the valid bit of the network identifier of the entry in the routing table and the destination address The valid bit is the entry of the logical operation whose operation is performed according to the address operator of the entry, and the first entry found is used as the matching entry, wherein the entries of the lookup table are sorted according to the priority.
  • the matching entry further includes operation information, where the operation information is used to indicate that the data packet is operated, according to Before the output port determined by the output port information in the matching entry forwards and sends the data packet, the method further includes: operating the data packet according to the operation information in the matching entry.
  • the address operator includes: not equal to, greater than, less than, greater than or equal to, or less than or equal to.
  • an embodiment of the present invention provides a computing device for routing, including: a processor, a memory, a bus, and a communication interface;
  • the memory is for storing a computing device execution instruction
  • the processor is coupled to the memory via the bus, and when the computing device is running, the processor executes the computer-executed instruction stored by the memory to A method of causing the computing device to perform the first aspect or any of the possible implementations of the first aspect, or the method of performing the second aspect or any of the possible implementations of the second aspect.
  • an embodiment of the present invention provides a routing device, including:
  • a receiving unit configured to receive a data packet, where the data packet carries a destination address of the data packet
  • a matching unit configured to determine, in the routing table, a matching entry corresponding to the destination address, where the entry of the routing table includes an address operator and a network identifier, and a valid bit of the network identifier of the matching entry is The logical operation result of the valid bit of the destination address being operated according to the address operator of the matching entry is true;
  • a sending unit configured to send the data packet from an output port determined according to output port information in the matching entry.
  • the valid bit of the network identifier is an overall value that is used as the network identifier, and the valid bit of the destination address refers to the destination address.
  • An overall value is an overall value.
  • the entry of the routing table further includes a mask, where a valid bit of the destination address is the destination address and location
  • the mask bit and the result of the operation as an overall value
  • the valid bit of the network identifier An overall value for the network identification and the result of the mask bit and operation.
  • the mask in a third possible implementation manner, includes a continuous mask and a non-continuous mask.
  • the entry of the routing table further includes priority information, where the priority information is used to indicate a priority of the belonging entry ;
  • the matching unit is configured to determine, in the routing table, a matching entry corresponding to the destination address, including: the matching unit searches for a valid bit of the network identifier of the entry in the routing table, and a valid bit of the destination address according to the entry
  • the logical operation result of the operation performed by the address operator is a true entry, and based on the priority information of the found entry, an entry having the highest priority is selected from the searched entry as the matching entry.
  • the matching unit is configured to determine, in the routing table, a matching entry corresponding to the destination address, including: the matching The unit searches for the valid bit of the network identifier of the entry in the order of priority from the highest priority in the order of priority, and the logical bit of the valid address of the destination address is calculated according to the address operator of the entry, and the logical operation result is true.
  • the first entry found is used as the matching entry, wherein the entries of the lookup table are sorted according to priority.
  • the sending unit is configured to send the data packet from an output port determined according to output port information in the matching entry
  • the method includes: the sending unit determines, according to the result that the address information is operated according to the output port information in the matching entry, the output port, and sends the data packet from the output port, where the address information includes at least the following A: the destination address, a source address of the data packet, a network identifier of the matching entry, and a current node address.
  • the sending unit is configured to send the data packet from an output port determined according to output port information in the matching entry
  • the method includes: the sending unit selects one port from the plurality of ports recorded in the output port information as the output port according to a hash algorithm, and forwards the data packet from the output port.
  • the device further includes an operation unit
  • the matching entry further includes operation information, where the operation information is used to indicate a The data packet is operated, and the operating unit is configured to be used according to the matching entry Operation information, operating on the data packet.
  • the address operator includes: not equal to, greater than, less than, greater than or equal to, or less than or equal to.
  • an embodiment of the present invention provides a routing device, including:
  • a receiving unit configured to receive a data packet, where the data packet carries a destination address of the data packet
  • a matching unit configured to determine, in the routing table, a matching entry corresponding to the destination address
  • a sending unit configured to determine, according to the result that the address information is operated according to the output port information in the matching entry, the output port, and send the data packet from the output port, where the address information includes at least one of the following The destination address, the source address of the data packet, the network identifier of the matching entry, and the current node address.
  • an entry of the routing table includes an address operator and a network identifier, where a valid bit of the network identifier of the matching entry and a valid bit of the destination address are in accordance with The result of the logical operation of the address operator of the matching entry is true.
  • the valid bit of the network identifier is an overall value that is used as the network identifier, and a valid bit of the destination address It refers to the overall value of the destination address.
  • the entry of the routing table further includes a mask, where a valid bit of the destination address is the destination address and the location
  • the mask bit and the result of the operation are an overall value
  • the valid bit of the network identifier is an overall value of the network identifier and the result of the mask bit and operation.
  • the mask includes a continuous mask and a non-continuous mask.
  • the entry of the routing table further includes priority information, where the priority information is used to indicate a priority of the belonging entry ;
  • the matching unit is configured to determine, in the routing table, a matching entry corresponding to the destination address, including: the matching unit searches for a valid bit of the network identifier of the entry in the routing table, and a valid bit of the destination address according to the entry
  • the logical operation result of the operation performed by the address operator is a true entry, and based on the priority information of the found entry, an entry having the highest priority is selected from the searched entry as the matching entry.
  • the matching unit is configured to determine, in the routing table, a matching entry corresponding to the destination address, where the matching unit searches for a valid bit of the network identifier of the entry in the routing table according to a priority from highest to lowest priority.
  • An entry that is a logical operation that operates with the valid bit of the destination address in accordance with the address operator of the entry, and the first entry found as the matching entry, wherein the entry of the lookup table is Priority is sorted.
  • the device further includes an operation unit, where the matching item further includes operation information, where the operation information is used to indicate a The data packet is operated, and the operation unit is configured to operate the data packet according to the operation information in the matching entry.
  • the address operator includes: equal to, not equal to, greater than, less than, greater than or equal to, or less than or equal to.
  • the network identifier includes, but is not limited to, a MAC address, an IP address, and the like.
  • the comparison items on both sides of the OP are compared as a whole value.
  • the comparison items on both sides of the OP may be in the order of the first byte to the nth dimension from the high byte to the low byte or from the first dimension. Arrange from the low byte to the high byte order in the nth dimension.
  • the comparison items on both sides of the OP may further select an m-dimensional label from the n-dimensional labels as an overall value, where the m-dimension The labels are arranged from the 1st dimension to the mth dimension in the order of the high byte to the low byte or from the 1st dimension to the mth dimension in the low byte to the high byte order.
  • the priority may be a value that is used to identify the priority of the lookup table entry, and the greater the value, the higher the priority. It can be that the smaller the value, the higher the priority.
  • the priority can also be other expressions that can distinguish between size or order, such as English characters.
  • the entries in the lookup table are arranged in descending order of priority or low to high.
  • the output port algorithm supports at least one of all mathematical operators such as addition, subtraction, multiplication, division, and shift.
  • the expression capability of the lookup table entry is enhanced, and the aggregation capability of the lookup table entry is improved.
  • reducing the size of the lookup table reducing on-chip storage requirements, reducing chip area, cost, table lookup time and power consumption, and improving network scale scalability.
  • FIG. 1 is a schematic diagram of a system logical structure of a routing method application scenario
  • FIG. 2 is a schematic diagram of a system logical structure of a routing method application scenario
  • FIG. 3 is an exemplary flowchart of a routing method according to an embodiment of the invention.
  • FIG. 4 is an exemplary flowchart of a routing method according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of a lookup table according to an embodiment of the invention.
  • FIG. 6 is a schematic diagram of a system logical structure of a routing method application scenario according to an embodiment of the invention.
  • FIG. 7 is a schematic diagram of a system logical structure of a routing method application scenario according to an embodiment of the invention.
  • FIG. 8 is a schematic diagram of a system logical structure of a routing method application scenario according to an embodiment of the invention.
  • FIG. 9 is a schematic diagram showing the logical structure of a routing device according to an embodiment of the invention.
  • FIG. 10 is a schematic diagram showing the logical structure of a routing device according to an embodiment of the invention.
  • FIG. 11 is a schematic structural diagram of a hardware of a routing system according to an embodiment of the invention.
  • FIG. 1 is a schematic diagram of a system logical structure of a routing method application scenario according to the present invention.
  • the network device 2 forwards the data packet by using the longest prefix matching technology.
  • the technology implements compression of the lookup table by aggregating lookup table entries having the same network identifier prefix and output, and after receiving the data packet,
  • the longest prefix matching technique implements the lookup of matching entries.
  • the network device 2 includes, but is not limited to, a router, a switch, and the like.
  • the network identifier includes, but is not limited to, an Internet Protocol (IP) address, and a Media Access Control (MAC). Address, etc.
  • IP Internet Protocol
  • MAC Media Access Control
  • Each table entry of the lookup table includes a matching domain and an action domain.
  • the matching domain includes the network identifier, or contains the network identifier and mask, which are used to implement matching of entries when looking up the table.
  • the network identifier may be any address label, and the general representation may be A1.A2 togethern; the mask is a prefix continuous mask.
  • the action field contains packet operation information, and generally includes at least output port information.
  • a network address aggregation based compression technique is used - the lookup table entries with the same network identification prefix and output are combined into one entry to compress the lookup table. As shown in FIG. 1, by aggregating table entries having the same network identifier prefix and output, the six table entries of the original lookup table of the network device 2 can be compressed into four, thereby achieving the purpose of the lookup table compression.
  • the network device 2 After receiving the data packet sent by the network C, the network device 2 extracts the IP address information of the destination node of the data packet from the data packet, and the destination IP address is 100.50.10.6, according to the compressed lookup table, based on the matching.
  • the 4th table entry is selected as the final matching entry, and the output port is extracted from the final matching table entry.
  • the information is such that information is provided for packet processing (eg, forwarding).
  • the network device 2 forwards the data packet received from the network C from the port 3, thereby implementing routing of the data packet.
  • FIG. 2 is a routing party Schematic diagram of the system logic structure of the application scenario, as shown in Figure 2, the network shown is a very important network in high-performance computers and data centers - fat tree, in which the fat tree network uses destination address routing (Dst -Routing) algorithm, and implementing the routing algorithm by using the above traditional table lookup routing technology to perform route lookup of the data packet.
  • the fat tree Dst-Routing routing algorithm is an Up-Down Routing.
  • the routing rule is: when the source host node sends a data packet to the destination host node, the data packet starts from the source node and continues upward. Routing and forwarding to the nearest public ancestor switching node (switch or router) of the source and destination host switching nodes, then entering the down-route and forwarding phase, routing down and forwarding to the destination host node.
  • the output port number of the switching node is determined by the destination address of the destination host node and the layer number of the switching node.
  • the fat tree addresses the switch and the host node according to the method of FIG. 2, if the destination host node network identifier of the data packet is A1.A27-8An, the layer number of the switching node currently arriving by the data packet is L, Then, when the route is up, the port M/2+An-L is selected as the output port number, and when the route is routed, An-L is selected as the output port number, where n is the number of fat tree layers and M is the number of switching node ports.
  • Network identification Mask Output port ... 1.0.0 255.255.0 0 ... 1.1.0 255.255.0 1 ... 0.0.0 255.255.0 2 ... 0.1.0 255.255.0 3 ... 2.0.0 255.255.0 2 ... 2.1.0 255.255.0 3 ... 3.0.0 255.255.0 2 ... 3.1.0 255.255.0 3 ...
  • routing method 300 is an exemplary flow diagram of a routing method 300 to achieve more efficient routing forwarding in accordance with an embodiment of the present invention.
  • routing method 300 can be performed by, for example, but not limited to, a router or switch. As shown in FIG. 3, the method 300 is specifically as follows:
  • S302 Receive a data packet, where the data packet carries a destination address of the data packet.
  • S304 Determine, in the routing table, a matching entry corresponding to the destination address, where the entry of the routing table includes an address operator and a network identifier, where a valid bit of the network identifier of the matching entry is related to the destination address The logical operation result of the valid bit operation according to the address operator of the matching entry is true.
  • S306 Send the data packet from an output port determined according to output port information in the matching entry.
  • the network identifier includes but is not limited to a MAC address, an IP address, and the like.
  • the valid bit of the network identifier is an overall value that is used to treat the network identifier
  • the valid bit of the destination address refers to an overall value that is used as the destination address.
  • the IP address 11.12.14.10 is taken as the value 11121410.
  • the entry of the routing table further includes a mask, where a valid bit of the destination address is an overall value of the destination address and the mask bit and the result of the operation, and the network identifier is valid.
  • the bit is an overall value of the network identification and the result of the mask bit and operation.
  • the mask includes a continuous mask and a non-continuous mask, for example, 255.0.255.0.
  • the comparison terms on both sides of the address operator are each compared as an integer value.
  • the comparison term of the address operator can be from high byte to low word from the first dimension to the nth dimension.
  • the order of the sections is arranged in order from the first dimension to the nth dimension from the low byte to the high byte order.
  • the comparison item of the address operator may further select an m-dimensional label from the n-dimensional label as an overall value, and the m-dimensional label is a high byte to a low word from the first dimension to the mth dimension.
  • the order is arranged in order from the first dimension to the mth dimension in descending order of high byte order.
  • the entry of the routing table further includes priority information, where the priority information is used to indicate a priority of the belonging entry;
  • Determining, in the routing table, a matching entry corresponding to the destination address comprising: a logic for finding a valid bit of the network identifier of the entry in the routing table and a valid bit of the destination address according to an address operator of the entry
  • the operation result is an entry, and according to the priority information of the found entry, the entry with the highest priority is selected from the searched entry as the matching entry.
  • the priority may be a value to identify the priority of the lookup table entry.
  • the priority can also be other expressions that can distinguish between size or order, such as English characters.
  • the determining, in the routing table, the matching entry corresponding to the destination address including: searching for a valid bit of the network identifier of the entry in the routing table according to a priority from highest to lowest, and the destination address.
  • the entry of the valid bit according to the address operator of the entry is a true entry, and the first entry found is used as the match entry, wherein the entries of the lookup table are sorted according to priority.
  • the sending, by the output port determined according to the output port information in the matching entry, the data packet comprises: determining, according to the result of the operation, outputting the port information according to the address information, determining the output port And transmitting the data packet from the output port, the address information comprising at least one of the following: the destination address, a source address of the data packet, a network identifier of the matching entry, and a current node address.
  • the sending the data packet from the output port determined according to the output port information in the matching entry including: selecting one port from the multiple ports recorded in the output port information according to a hash algorithm Describe the output port and forward the data packet from the output port.
  • the output port algorithm supports at least one of all mathematical operators such as addition, subtraction, multiplication, division, and shift.
  • the matching entry further includes operation information, where the operation information is used to indicate that the data packet is operated, and the output port determined according to the output port information in the matching entry is forwarded before sending the data packet. Further comprising: operating the data packet according to the operation information in the matching entry.
  • the expression capability of the lookup table entry is enhanced, and the aggregation capability of the lookup table entry is improved.
  • reducing the size of the lookup table reducing on-chip storage requirements, reducing chip area, cost, table lookup time and power consumption, and improving network scale scalability.
  • routing method 400 can be performed by, for example, but not limited to, a router or switch. As shown in FIG. 4, the method 400 is specifically:
  • S402 Receive a data packet, where the data packet carries a destination address of the data packet.
  • S406 Determine, according to the result that the address information is operated according to the output port information in the matching entry, the output port, and send the data packet from the output port, where the address information includes at least one of the following: Describe the destination address, the source address of the data packet, the network identifier of the matching entry, and the current node address.
  • the output port algorithm supports at least one of all mathematical operators such as addition, subtraction, multiplication, division, and shift.
  • the entry of the routing table includes an address operator and a network identifier, and the logic of the valid bit of the network identifier of the matching entry and the valid bit of the destination address are operated according to the address operator of the matching entry. The result of the operation is true.
  • the valid bit of the network identifier is an overall value that is used to treat the network identifier
  • the valid bit of the destination address refers to an overall value that is used as the destination address
  • the entry of the routing table further includes a mask, where a valid bit of the destination address is an overall value of the destination address and the mask bit and the result of the operation, and the network identifier is valid.
  • the bit is an overall value of the network identification and the result of the mask bit and operation.
  • the mask includes Continued mask and non-continuous mask, for example 255.0.255.0.
  • the comparison terms on both sides of the address operator are each compared as an integer value.
  • the comparison term of the address operator may be arranged from the first byte to the nth dimension in a high byte to a low byte order or from the first dimension to the nth dimension in a low byte to a high byte order.
  • the comparison item of the address operator may further select an m-dimensional label from the n-dimensional label as an overall value, and the m-dimensional label is a high byte to a low word from the first dimension to the mth dimension.
  • the order is arranged in order from the first dimension to the mth dimension in descending order of high byte order.
  • the entry of the routing table further includes priority information, where the priority information is used to indicate a priority of the belonging entry;
  • Determining, in the routing table, a matching entry corresponding to the destination address comprising: a logic for finding a valid bit of the network identifier of the entry in the routing table and a valid bit of the destination address according to an address operator of the entry
  • the operation result is an entry, and according to the priority information of the found entry, the entry with the highest priority is selected from the searched entry as the matching entry.
  • the determining, in the routing table, the matching entry corresponding to the destination address including: searching for a valid bit of the network identifier of the entry in the routing table according to a priority from highest to lowest, and the destination address.
  • the entry of the valid bit according to the address operator of the entry is a true entry, and the first entry found is used as the match entry, wherein the entries of the lookup table are sorted according to priority.
  • the matching entry further includes operation information, where the operation information is used to indicate that the data packet is operated, and the output port determined according to the output port information in the matching entry is forwarded before sending the data packet. Further comprising: operating the data packet according to the operation information in the matching entry.
  • the network identifier includes but is not limited to a MAC address, an IP address, and the like.
  • the expression capability of the lookup table entry is enhanced, and the aggregation capability of the lookup table entry is improved.
  • the size of the lookup table reduces the on-chip storage requirements, reduces chip area, cost, table lookup time and power consumption, and improves network scale scalability.
  • FIG. 5 is a schematic structural diagram of a lookup table 500 according to an embodiment of the invention. As shown in FIG. 5, lookup table 500 includes a match field 502 and an action field 504.
  • Matching field 502 includes, but is not limited to, a network identity and address operator.
  • the network identifier may be represented as an n-dimensional label A1.A2 togetherAn, which may be referred to as a first dimension, a second dimension, ..., an nth dimension from left to right.
  • Each dimension of the network identifier is a numerical value, which can be expressed in any binary form such as binary, decimal, and hexadecimal as needed.
  • the network identifier includes but is not limited to a MAC address, an IP address, and the like.
  • the matching field 502 further includes a mask, where the mask is an n-dimensional label corresponding to the network identifier, and the dimension of the dimension and the value of each dimension is the same as the network identifier.
  • the mask performs a binary "bit and (&)" operation with the network identifier to generate an address for performing a lookup table matching. Therefore, it can be considered that a certain bit of a certain dimension value in the mask is 1, and the network identifier corresponds to The binary bit is valid.
  • the mask field supports both continuous and non-continuous masks, for example, 255.0.255.0.
  • the OP is used to perform a comparison operation "destination address OP network identification” or “(destination address & mask) OP (network identification & mask)", where "&" indicates a bit and an operation.
  • the comparison items on both sides of the OP are each compared as a whole value.
  • the comparison items on both sides of the OP may be arranged from the first byte to the nth dimension in a high byte to a low byte order or from the first dimension to the nth dimension in a low byte to a high byte order.
  • the comparison items on both sides of the OP may also respectively select an m-dimensional label from the n-dimensional label as an overall value, and the m-dimensional label is high byte to low byte from the first dimension to the m-th dimension. Arrange sequentially or from low byte to high byte order from the first dimension to the mth dimension.
  • means "the first and third dimension values are not equal to the set of addresses of 210 and 10", so that a certain subset of addresses can be filtered;
  • the matching field 502 further includes priority information.
  • the priority can be a value that identifies the priority of the lookup table entry. The greater the value, the higher the priority, or the smaller the value, the higher the priority.
  • the priority can also be other expressions that can distinguish between size or order, such as English characters.
  • all entries of the lookup table 500 are sorted according to priority from high to low.
  • the matching is performed in descending order of priority.
  • the output port field supports both static and dynamic output port representations.
  • the static port representation is consistent with the traditional lookup table, with a specific constant value representing the port number.
  • the dynamic port representation is based on an algorithm implementation to enhance the expressive power of the output port in the lookup table entry.
  • Expressions for dynamic output ports include, but are not limited to, the following operations: DimValue(addr,k), FirstDiffDim(addr1, addr2), or FirstDiffDimValue(addr1, addr2).
  • DimValue(addr,k) takes the kth dimension component in the address addr (hereinafter abbreviated as "DV");
  • FirstDiffDim compares the addresses addr1 and address addr2, and returns the dimension number of the first different dimension component (hereinafter abbreviated as "FDD");
  • FirstDiffDimValue(addr1, addr2) Compares the addresses addr1 and address addr2, determines the dimension number of the first different dimension, and returns the component of addr1 in this dimension (hereinafter abbreviated as "FDDV").
  • the dynamic port supports address symbol representation, and the address symbol includes but is not limited to: destination address (dst), source address (src), current node address (hst), network identifier (net), and the like.
  • Addr, addr1, and addr2 can each be a destination address (dst), a source address (src), a current node address (hst), or a network identifier (net).
  • dst is the destination address in the data packet
  • src is the source address in the data packet
  • hst is the node to which the data packet currently arrives (including The address of the network device, net is the value of the network identification field in the currently processed lookup table entry of the lookup table of the current node.
  • the dynamic port algorithm supports at least one of all mathematical operators such as addition, subtraction, multiplication, division, and shift.
  • DVD(dst, 2) means "the second-dimensional address component of the destination address is used as an output port".
  • dst 5.6.7.8.9, its output port is 6;
  • DVD(dst, 4)+4" means "the value of the 4th-order address component in the destination address plus 4 as an output port".
  • dst 5.6.7.8.9
  • the output port is 12.
  • FDD(dst, src) means "the first dimension number different from the dimension component in the destination and source addresses as the output port".
  • FDDV(dst, src) means "the destination address component of the dimension of the first different dimension component in the destination and source address is taken as the output port".
  • dst 1.5.7 and src is 1.6.4, the output port is 5.
  • the output port includes N ports, and any one of the N ports can implement forwarding of the data packet, where N is a natural number greater than 0.
  • the network device selects one forwarding port from the N ports according to a hash algorithm, for forwarding the data packet.
  • the action field 504 also supports other action information for operating on the data packet.
  • the lookup table structure disclosed in this embodiment by adding an operation field to the lookup table entry, the expression capability of the lookup table entry is enhanced, and the aggregation capability of the lookup table entry is improved. Thereby reducing the size of the lookup table, reducing on-chip storage requirements, reducing chip area, cost, table lookup time and power consumption, and improving network scale scalability.
  • FIG. 6 is a schematic diagram of a system logical structure of a table lookup routing method application scenario 600 according to an embodiment of the present invention.
  • the network shown is a very important network in a high performance computer and a data center - a fat tree.
  • the figure shows the use of the method of the present invention.
  • the fat tree network performs a table lookup routing implementation based on a destination address routing (Dst-Routing) algorithm and a routing forwarding process of a data packet from a source node 1.0.0 to a destination node 3.1.1.
  • Dst-Routing destination address routing
  • the fat tree Dst-Routing routing algorithm is an up/ Up-Down Routing, the routing rule is:
  • the routing rule is:
  • the data packet starts from the source node and is always routed up and forwarded to the nearest source and destination host switching node.
  • the common ancestor switches nodes (switches or routers) and then enters the down-route and forwarding phase, routing and forwarding down to the destination host node.
  • the output port number of the switching node is determined by the network identifier (destination address) of the destination host node and the layer number of the switching node.
  • the fat tree addresses the switch and the host node according to the manner of FIG. 6, if the destination address of the destination host node of the data packet is A1.A2 togetherAn, the layer number of the switching node currently arriving by the data packet is L. Then, select port M/2+An-L as the output port number when routing upwards, and select An-L as the output port number when routing downwards, where n is the number of fat tree layers and M is the number of switching node ports.
  • the end node (host node) address is represented as A1.A2.A3
  • the switching node address is represented as B1.B2.(L+M/2), where M is the number of ports of the switching node.
  • the data packet shall be sent from the source node 1.0.0 to the destination node 3.1.1.
  • the destination address routing algorithm is adopted, the destination address is routed through the switching nodes 1.0.2, 1.1.3, 1.1.4, 3.1.3 and 3.1. 2.
  • the routing method according to the present invention performs routing and forwarding of data packets, the lookup table of the switching node 1.0.2 is as shown in Table 2.
  • the network device slave data at the switching node 1.0.2
  • the packet extracts the destination node address, whose destination node address is 3.1.1, and finds the matching entry according to the logical result of "(destination address & mask) OP (network identifier & mask)". If the result is "true", it means matching .
  • the result of the operation is "true", indicating a match.
  • the switching node is 1.0. .2 forward the packet from port 3.
  • the next hop switching node connected to port 3 is 1.1.3, so the packet arrives at port 3 of switching node 1.0.2 and arrives at switching node 1.1.3.
  • the lookup table of the switching node 1.1.3 is shown in Table 3.
  • the next hop switching node connected to port 3 is 1.1.4. , so the packet is sent from port 3 of the switching node 1.1.3 to the switching node 1.1.4.
  • the lookup table of the switching node 1.1.4 is shown in Table 4.
  • the final output port is port 3, and the switching node 1.1.4 will be the data.
  • the packet is forwarded from port 3, and the next hop switching node connected to port 3 is 3.1.3, so switching node 1.1.4 forwards the packet from port 3 to switching node 3.1.3.
  • the lookup table of the switching node 3.1.3 is as shown in Table 5.
  • the logical operation result of .0.0) ⁇ (3.0.0&255.0.0)” is “false”, indicating no match.
  • the final output port is port 1, and the switching node 3.1.2 will The data packet is forwarded from port 1, and the next hop node connected to port 1 is the destination node 3.1.1, so the switching node 1.3.1 forwards the data packet from port 1 to the destination node 3.1.1, thereby completing the packet from the source. Routing and forwarding from node 1.0.0 to destination node 3.1.1.
  • the lookup table of the fat tree top-level switching node can be expressed as the general form shown in Table 7, non- The top-level switching node lookup table can be represented in the general form shown in Table 8.
  • the mask field is represented here in binary.
  • the routing method disclosed in this embodiment by adding an operation field to the lookup table entry, the expression capability of the lookup table entry is enhanced, thereby improving the aggregation capability of the lookup table entry.
  • the size of the lookup table is reduced, the requirement for on-chip storage space is reduced, thereby reducing chip area, cost, table lookup time and power consumption, and improving network scale scalability.
  • FIG. 7 is a schematic diagram of a system logical structure of a routing method application scenario 700 according to an embodiment of the present invention.
  • an XY routing algorithm of a two-dimensional mesh network is taken as an example to illustrate an application scenario of the present invention.
  • a mesh network is a direct network of rules.
  • Each node is both a compute node and a switch node.
  • each node is only associated with it in each dimension. Neighboring (two) nodes are connected.
  • Mesh networks are widely used because of their short connection, easy packaging, good locality, and incremental expansion.
  • the lookup table is as shown in Table 9.
  • Network identification Mask Operator priority Output port ... 2.0 255.0 ⁇ 10 0 ... 2.0 255.0 > 10 2 ... 0.2 0.255 ⁇ 20 1 ... 0.2 0.255 > 20 3 ...
  • the number of entries required for the lookup table of any node is not more than the number of ports of the node.
  • FIG. 8 is a schematic diagram of a system logical structure of a routing method application scenario 800 according to an embodiment of the present invention.
  • a BCube network is taken as an example to illustrate an application scenario of the routing method of the present invention.
  • BCube is a modular solution for large-scale networks. It uses the hyper-cube node connection relationship as a recursive rule. All servers in the same position in different recursive units in the same layer are connected to each other through a switch. This structure requires multiple ports per server, and has the advantages of high hypercube connectivity, small diameter, and high reliability.
  • the lookup table of the source node 1.2 is as shown in Table 10, and the purpose of the data packet is The node address is 3.3, and the matching entry is found according to the logical result of "(destination address & mask) OP (network identifier & mask)". If the result is "true”, it means matching.
  • the final output port is port 1, and the source node 1.2 will data.
  • the packet is sent from port 1, and the next hop switching node connected to port 1 is 2.5, and the source node 1.2 forwards the packet from port 1 to switching node 2.5.
  • the lookup table of node 3.2 is shown in Table 12.
  • the final output port is port 0, and node 3.2 will be the data packet. Forwarded from port 0, the next hop switching node connected to port 0 is 3.4, and node 3.2 forwards the data packet from port 0 to switching node 3.4.
  • the lookup table of the switching node 3.4 is as shown in Table 13.
  • the final output port is port 3, and the switching node 3.4 sends the packet from port 3. issue.
  • the next hop node connected to port 3 is the destination node 3.3, so the switching node 3.4 forwards the data packet from port 3 to the destination node 3.3.
  • the routing method disclosed in this embodiment by adding an operation field to the lookup table entry, the expression capability of the lookup table entry is enhanced, thereby improving the aggregation capability of the lookup table entry, and the number of switching nodes and arbitrary network layers for any number of ports.
  • the expression capability of the lookup table entry is enhanced, thereby improving the aggregation capability of the lookup table entry, and the number of switching nodes and arbitrary network layers for any number of ports.
  • only one lookup table entry is required for any node lookup table.
  • FIG. 9 is a schematic diagram of a logical structure of a routing device 900 according to an embodiment of the present invention. As shown in FIG. 9, the routing device 900 includes at least a receiving unit 902, a matching unit 904, and a sending unit 906.
  • the receiving unit 902 is configured to receive a data packet, where the data packet carries a destination address of the data packet;
  • the matching unit 904 is configured to determine, in the routing table, a matching entry corresponding to the destination address, where the entry of the routing table includes an address operator and a network identifier, where the valid identifier of the network identifier of the matching entry The logical operation result of the valid bit of the destination address being operated according to the address operator of the matching entry is true;
  • the sending unit 906 is configured to send the data packet from an output port determined according to the output port information in the matching entry.
  • the comparison terms on both sides of the address operator are each compared as an integer value.
  • the comparison items on both sides of the address operator may be arranged from the first byte to the nth dimension in a high byte to a low byte order or from the first dimension to the nth dimension in a low byte to a high byte order.
  • the comparison items on both sides of the address operator may each select an m-dimensional label from the n-dimensional label as an overall value, and the m-dimensional label is high byte to low from the first dimension to the mth dimension.
  • the byte order is arranged or from the 1st dimension to the mth dimension in descending order of high byte order.
  • the valid bit of the network identifier is an overall value that is used to treat the network identifier
  • the valid bit of the destination address refers to an overall value that is used as the destination address
  • the entry of the routing table further includes a mask, where a valid bit of the destination address is an overall value of the destination address and the mask bit and the result of the operation, and the network identifier is valid.
  • the bit is an overall value of the network identification and the result of the mask bit and operation.
  • the mask field supports both continuous and non-continuous masks, for example, 255.0.255.0.
  • the entry of the routing table further includes priority information, where the priority information is used to indicate a priority of the belonging entry;
  • the matching unit 904 is configured to determine, in the routing table, a matching entry corresponding to the destination address, where the matching unit 904 searches the routing table for the valid bit of the network identifier of the entry and the valid bit of the destination address.
  • the logical operation result of the operation performed by the address operator of the entry is a true entry, and according to the priority information of the found entry, the entry with the highest priority is selected from the searched entry as the match. entry.
  • the priority may be a value to identify the priority of the lookup table entry.
  • the priority can also be other expressions that can distinguish between size or order, such as English characters.
  • the matching unit 904 is configured to determine, in the routing table, a matching entry corresponding to the destination address, where the matching unit 904 searches for a network of entries in a routing table according to a priority from highest to lowest priority.
  • An entry of a valid bit of the identifier and a valid bit of the destination address in accordance with an address operator of the entry is a true entry, and the first entry found is the match entry, wherein the lookup
  • the entries for the table are sorted by priority.
  • the sending by the sending unit 906, the sending, by using the output port determined according to the output port information in the matching entry, the sending, by the sending unit 906, according to the address information, outputting the port information according to the matching entry.
  • the address information includes at least one of the following: the destination address, a source address of the data packet, and the Match the network ID of the entry and the current node address.
  • the output port algorithm supports at least one of all mathematical operators such as addition, subtraction, multiplication, division, and shift.
  • the sending, by the sending unit 906, the sending, by the sending unit, the data packet, according to the output port information in the matching entry includes: the sending unit 906 records from the output port information according to a hash algorithm. One of the plurality of ports is selected as the output port, and the data packet is forwarded from the output port.
  • the device further includes an operation unit
  • the matching entry further includes operation information
  • the operation information is used to indicate operation on the data packet
  • the operation unit is configured to perform operations according to the matching item.
  • Information operating on the data packet.
  • FIG. 10 is a schematic diagram of a logical structure of a routing device 1000 according to an embodiment of the present invention.
  • the routing device 1000 includes at least a receiving unit 1002, a matching unit 1004, and a sending unit 1006.
  • the receiving unit 1002 is configured to receive a data packet, where the data packet carries a destination address of the data packet;
  • the matching unit 1004 is configured to determine, in the routing table, a matching entry corresponding to the destination address
  • the sending unit 1006 is configured to determine, according to the result that the address information is operated according to the output port information in the matching entry, the output port, and send the data packet from the output port, where the address information includes at least the following A: the destination address, a source address of the data packet, a network identifier of the matching entry, and a current node address.
  • the output port algorithm supports at least one of all mathematical operators such as addition, subtraction, multiplication, division, and shift.
  • the entry of the routing table includes an address operator and a network identifier, and the logic of the valid bit of the network identifier of the matching entry and the valid bit of the destination address are operated according to the address operator of the matching entry. The result of the operation is true.
  • the comparison terms on both sides of the address operator are each compared as an integer value.
  • the comparison items on both sides of the address operator may be arranged from the first byte to the nth dimension in a high byte to a low byte order or from the first dimension to the nth dimension in a low byte to a high byte order.
  • the comparison items on both sides of the address operator may each select an m-dimensional label from the n-dimensional label as an overall value, and the m-dimensional label is high byte to low from the first dimension to the mth dimension.
  • the byte order is arranged or from the 1st dimension to the mth dimension in descending order of high byte order.
  • the valid bit of the network identifier is an overall value that is used to treat the network identifier
  • the valid bit of the destination address refers to an overall value that is used as the destination address
  • the entry of the routing table further includes a mask, where a valid bit of the destination address is an overall value of the destination address and the mask bit and the result of the operation, and the network identifier is valid.
  • the bit is an overall value of the network identification and the result of the mask bit and operation.
  • the mask includes a continuous mask and a non-continuous mask.
  • the entry of the routing table further includes priority information, where the priority information is used to indicate a priority of the belonging entry;
  • the matching unit 1004 is configured to determine, in the routing table, a matching entry corresponding to the destination address, where the matching unit 1004 searches for a valid bit of the network identifier of the entry in the routing table and a valid bit of the destination address.
  • the logical operation result of the operation performed by the address operator of the entry is a true entry, and according to the priority information of the found entry, the entry with the highest priority is selected from the searched entry as the match. entry.
  • the priority may be a value to identify the priority of the lookup table entry.
  • the priority can also be other expressions that can distinguish between size or order, such as English characters.
  • the matching unit 1004 is configured to determine, in the routing table, a matching entry corresponding to the destination address, where the matching unit 1004 searches for a network of entries in a routing table according to a priority from highest to lowest priority.
  • An entry of a valid bit of the identifier and a valid bit of the destination address in accordance with an address operator of the entry is a true entry, and the first entry found is the match entry, wherein the lookup
  • the entries for the table are sorted by priority.
  • the device further includes an operation unit
  • the matching entry further includes operation information
  • the operation information is used to indicate operation on the data packet
  • the operation unit is configured to perform operations according to the matching item.
  • Information operating on the data packet.
  • the network identifier includes but is not limited to a MAC address, an IP address, and the like.
  • FIG. 11 is a schematic diagram showing the hardware structure of a computing device device 1100 according to an embodiment of the invention.
  • computing device 1100 includes a processor 1102, a memory 1104, an input/output interface 1106, a communication interface 1108, and a bus 1110.
  • the processor 1102, the memory 1104, the input/output interface 1106, and the communication interface 1108 implement a communication connection with each other through the bus 1110.
  • the processor 1102 can be a general-purpose central processing unit (CPU), a microprocessor, and an application-specific integrated circuit (Application Specific Integrated). Circuit, ASIC), or one or more integrated circuits, for performing related procedures to implement the technical solutions provided by the embodiments of the present invention.
  • CPU central processing unit
  • microprocessor a microprocessor
  • ASIC application-specific integrated circuit
  • the memory 1104 may be a read only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM).
  • the memory 1104 can store an operating system and other applications.
  • the program code for implementing the technical solution provided by the embodiment of the present invention is stored in the memory 1104 and executed by the processor 1102.
  • the input/output interface 1106 is for receiving input data and information, and outputting data such as operation results.
  • Communication interface 1108 enables communication between computing device 1100 and other devices or communication networks using transceivers such as, but not limited to, transceivers.
  • Bus 1110 can include a path for communicating information between various components of computing device 1100, such as processor 1102, memory 1104, input/output interface 1106, and communication interface 1108.
  • computing device 1100 shown in FIG. 11 only shows the processor 1102, the memory 1104, the input/output interface 1106, the communication interface 1108, and the bus 1110, in a specific implementation process, those skilled in the art should It is understood that computing device 1100 also includes other devices necessary to achieve proper operation. Also, those skilled in the art will appreciate that computing device 1100 may also include hardware devices that implement other additional functions, depending on the particular needs. Moreover, those skilled in the art will appreciate that computing device 1100 may also only include the components necessary to implement embodiments of the present invention, and does not necessarily include all of the devices shown in FIG.
  • the hardware structure shown in FIG. 11 and the foregoing description are applicable to various routing devices provided by the embodiments of the present invention, and are applicable to performing various routing methods provided by the embodiments of the present invention.
  • the disclosed systems, devices, and methods may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the modules is only a logical function division, and may be implemented in another manner, for example, multiple modules or components may be combined or may be Integrate into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or module, and may be electrical, mechanical or otherwise.
  • the modules described as separate components may or may not be physically separate.
  • the components displayed as modules may or may not be physical modules, that is, may be located in one place, or may be distributed to multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
  • the above integrated modules can be implemented in the form of hardware or in the form of hardware plus software function modules.
  • the above-described integrated modules implemented in the form of software function modules can be stored in a computer readable storage medium.
  • the software functional modules described above are stored in a storage medium and include instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform some of the steps of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes: a mobile hard disk, a read-only memory (English: Read-Only Memory, ROM for short), a random access memory (English: Random Access Memory, RAM for short), a magnetic disk or an optical disk, and the like. The medium of the code.

Abstract

Provided are a method and device. An operation field can be added to a lookup table entry, and an expression capability of the lookup table entry is enhanced, so as to improve an aggregation capability of the lookup table entry. The method comprises: receiving a data packet, wherein the data packet carries a destination address of the data packet; determining a matching entry corresponding to the destination address in a routing table, wherein an entry of the routing table contains an address operator and a network identifier, and a logical operation result of the operation performed on a significant bit of the network identifier of the matching entry and a significant bit of the destination address according to the address operator of the matching entry is true; and sending the data packet from an output port determined according to output port information in the matching entry. By means of the technical solution disclosed in the present invention, the scale of a lookup table can be reduced, and the demands of a network device for an on-chip storage space are effectively reduced, so as to reduce the area, costs, table lookup time and power consumption of a chip.

Description

一种路由方法和设备Routing method and device 技术领域Technical field
本发明涉及互联网信息服务领域,特别是涉及一种查表路由方法和设备。The present invention relates to the field of Internet information services, and in particular, to a table lookup routing method and device.
背景技术Background technique
当前的计算机网络,比如以太网和因特网,一般采用包交换技术(又称“分组交换”)对数据进行传输。在包交换网络中,主机节点间通信时,通信数据首先在源主机节点被切分和封装在一个个数据包,并注入网络,然后经过网络设备的路由和转发进行传输,最终数据包到达目的主机节点,恢复和合并成原有通信数据。在该过程中,网络设备,比如交换机和路由器,对每一个数据包进行独立的路由和转发,即当一个数据包到达网络设备的输入端口时,网络设备基于数据包中的地址信息,比如目的MAC地址或目的IP地址,确定该数据包的输出端口,并将该数据包从输入端口交换到输出端口。通常,将“确定数据包的输出端口的过程”称为“路由”,将“数据包从输入端口交换到输出端口的过程”称为“转发”。在当前的大部分网络设备中,对数据包的路由是通过查表实现的:在网络设备中存在一张或多张逻辑“查找表”,也叫“路由表”(比如,MAC转发表或IP路由表),每个表包含一个或多个表条目,每个表条目包含地址匹配信息和输出端口等信息;通过提取数据包中的地址信息和表条目中的地址信息进行匹配,以确定匹配的表条目,并从匹配的表条目中提取输出端口信息以确定输出端口。这种路由方式称为“查表路由”。Current computer networks, such as Ethernet and the Internet, typically use packet-switched technology (also known as "packet switching") to transmit data. In a packet switching network, when communication is performed between host nodes, communication data is first segmented and encapsulated in a single data packet at the source host node, and injected into the network, and then transmitted and routed through the network device for transmission, and finally the data packet arrives at the destination. The host node is restored and merged into the original communication data. In this process, network devices, such as switches and routers, independently route and forward each data packet, that is, when a data packet arrives at the input port of the network device, the network device based on the address information in the data packet, such as the destination. The MAC address or destination IP address determines the output port of the packet and switches the packet from the input port to the output port. Generally, the process of "determining the output port of a packet" is referred to as "routing," and the process of "switching a packet from an input port to an output port" is referred to as "forwarding." In most current network devices, routing of data packets is performed by looking up a table: one or more logical "lookup tables", also called "routing tables" (such as MAC forwarding tables) or IP routing table), each table contains one or more table entries, each table entry contains information such as address matching information and output port; matching by extracting the address information in the data packet and the address information in the table entry to determine Match the table entries and extract the output port information from the matching table entries to determine the output port. This type of routing is called "table lookup routing."
在计算机网络中,查表路由有着广泛的使用。比如,由二层交换机构建的以太网中,交换机中存放着一张学习得到的“转发表”,该表的表条目中包含MAC地址和输出端口号等信息。当交换机接收到一个数据包时,从数据包中提取目的MAC地址,并将它与转发表中表条目的MAC地址进行比较,以确定匹配的表条目(目的MAC地址与表条目中的MAC地址相等),从而得到输出端口号。在IP网络中,路由器也执行类似的查表路由机制:在每个路由器中存放着通过路由协议学习得到的查找表(路由表),查找表的表条目中包含网络标识、网络掩码、输出端口号和下一跳网络标识等信息。当路 由器接收到一个数据包时,从数据包中提取目的IP地址,并执行基于掩码的匹配,以确定匹配的表条目,从而得到输出端口号和下一跳网络标识等信息。In computer networks, table lookup routing has a wide range of uses. For example, in an Ethernet built by a Layer 2 switch, a learned forwarding table is stored in the switch, and the table entry includes information such as a MAC address and an output port number. When the switch receives a data packet, it extracts the destination MAC address from the data packet and compares it with the MAC address of the table entry in the forwarding table to determine the matching table entry (the destination MAC address and the MAC address in the table entry). Equal) to get the output port number. In the IP network, the router also performs a similar lookup table routing mechanism: in each router, a lookup table (routing table) learned through a routing protocol is stored, and the table entry of the lookup table includes the network identifier, the network mask, and the output. Information such as port number and next hop network identifier. When the road When the receiver receives a data packet, the destination IP address is extracted from the data packet, and a mask-based matching is performed to determine a matching table entry, thereby obtaining information such as an output port number and a next hop network identifier.
对于网络设备,查表路由的性能通常是其性能的瓶颈,而查找表的大小是查表路由性能的决定因素和网络设备成本的关键因素。通常查找表越大,查表速度就越慢,查表过程消耗的功耗就越多。同时,查找表越大,所需要的片上存储或片外存储就越多,进而要求设备有很大的片上或片外存储容量。因为存储容量,尤其是片上存储容量,是非常昂贵的,这会大幅度地增加网络设备成本。更重要的是,对于给定的网络设备,其所拥有的片上或片外存储容量是有限的,所以能支持的表容量是有限的。当表大小超过表容量时,部分表条目就会丢失,导致路由失败。因为表大小与网络规模成正向关系,所以表的大小还影响到网络设备所能构建的网络的最大规模。因此,需要开发新的技术来解决这一问题。For network devices, the performance of lookup table routing is usually the bottleneck of its performance, and the size of the lookup table is a determining factor in the performance of the table lookup and a key factor in the cost of the network device. Generally, the larger the lookup table, the slower the lookup table, and the more power consumed by the lookup process. At the same time, the larger the lookup table, the more on-chip or off-chip storage is required, which in turn requires the device to have large on-chip or off-chip storage capacity. Because storage capacity, especially on-chip storage capacity, is very expensive, it can significantly increase network equipment costs. More importantly, for a given network device, the on-chip or off-chip storage capacity it has is limited, so the supported table capacity is limited. When the table size exceeds the table capacity, some of the table entries are lost, causing the route to fail. Because the table size is positively related to the size of the network, the size of the table also affects the maximum size of the network that the network device can build. Therefore, new technologies need to be developed to solve this problem.
发明内容Summary of the invention
有鉴于此,本发明实施例提供了一种路由方法和设备,提高了查找表条目的聚合能力,从而减小了查找表的规模。In view of this, the embodiment of the present invention provides a routing method and device, which improves the aggregation capability of a lookup table entry, thereby reducing the size of the lookup table.
第一方面,本发明实施例提供了一种路由方法,包括:In a first aspect, an embodiment of the present invention provides a routing method, including:
接收数据包,所述数据包中携带所述数据包的目的地址;Receiving a data packet, where the data packet carries a destination address of the data packet;
在路由表中确定与所述目的地址对应的匹配条目,其中,所述路由表的条目中包含地址运算符和网络标识,所述匹配条目的网络标识的有效位与所述目的地址的有效位按照所述匹配条目的地址运算符进行运算的逻辑运算结果为真;Determining, in the routing table, a matching entry corresponding to the destination address, wherein the entry of the routing table includes an address operator and a network identifier, and a valid bit of the network identifier of the matching entry and a valid bit of the destination address The logical operation result of the operation according to the address operator of the matching entry is true;
从根据所述匹配条目中输出端口信息确定的输出端口发送所述数据包。The data packet is transmitted from an output port determined according to output port information in the matching entry.
结合第一方面,在第一种可能的实现方式中,所述网络标识的有效位为将所述网络标识当做的一个整体数值,所述目的地址的有效位是指将所述目的地址当做的一个整体数值。With reference to the first aspect, in a first possible implementation, the valid bit of the network identifier is an overall value that is used as the network identifier, and the valid bit of the destination address refers to the destination address. An overall value.
结合第一方面或以上任一项可能的实现方式,在第二种可能的实现方式中,所述路由表的条目中还包括掩码,所述目的地址的有效位为所述目的地址与所述掩码位与操作的结果当做的一个整体数值,所述网络标识的有效位为所述网络标识与所述掩码位与操作的结果当做的一个整体数值。With reference to the first aspect or any of the foregoing possible implementation manners, in a second possible implementation manner, the entry of the routing table further includes a mask, where a valid bit of the destination address is the destination address and the location The mask bit and the result of the operation are an overall value, and the valid bit of the network identifier is an overall value of the network identifier and the result of the mask bit and operation.
结合第一方面或以上任一项可能的实现方式,在第三种可能的实现方式 中,所述掩码包括连续掩码和非连续掩码。In combination with the first aspect or any of the above possible implementations, in a third possible implementation The mask includes a continuous mask and a non-continuous mask.
结合第一方面或以上任一项可能的实现方式,在第四种可能的实现方式中,所述路由表的条目中还包括优先级信息,所述优先级信息用于指示所属条目的优先级;With reference to the first aspect or any one of the foregoing possible implementation manners, in a fourth possible implementation manner, the entry of the routing table further includes priority information, where the priority information is used to indicate a priority of the belonging entry ;
所述在路由表中确定与所述目的地址对应的匹配条目,包括:在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,并根据所述查找到的条目的优先级信息,从所述查找到的条目中,选择优先级最高的条目,作为所述匹配条目。Determining, in the routing table, a matching entry corresponding to the destination address, comprising: a logic for finding a valid bit of the network identifier of the entry in the routing table and a valid bit of the destination address according to an address operator of the entry The operation result is an entry, and according to the priority information of the found entry, the entry with the highest priority is selected from the searched entry as the matching entry.
结合第一方面或以上任一项可能的实现方式,在第五种可能的实现方式中,所述在路由表中确定与所述目的地址对应的匹配条目,包括:按照优先级从高到低的顺序在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,将所述找到的第一个条目作为所述匹配条目,其中,所述查找表的条目按照优先级进行排序。With reference to the first aspect or any of the foregoing possible implementation manners, in a fifth possible implementation manner, the determining, in the routing table, a matching entry corresponding to the destination address, including: following a priority from high to low The order in which the logical bit of the network identifier of the entry is found in the routing table and the valid bit of the destination address is logically operated according to the address operator of the entry, and the first entry found is taken as The matching entry, wherein the entries of the lookup table are sorted according to priority.
结合第一方面或以上任一项可能的实现方式,在第六种可能的实现方式中,所述从根据所述匹配条目中的输出端口信息确定的输出端口发送所述数据包包括:根据地址信息按照所述匹配条目中输出端口信息进行运算的结果,确定所述输出端口,并将所述数据包从所述输出端口进行发送,所述地址信息包括以下至少一种:所述目的地址、所述数据包的源地址、所述匹配条目的网络标识和当前节点地址。With reference to the first aspect or any one of the foregoing possible implementation manners, in a sixth possible implementation manner, the sending, by the output port determined according to the output port information in the matching entry, the data packet comprises: according to an address Determining, by the operation result of the output port information in the matching entry, the output port, and transmitting the data packet from the output port, where the address information includes at least one of the following: the destination address, The source address of the data packet, the network identifier of the matching entry, and the current node address.
结合第一方面或以上任一项可能的实现方式,在第七种可能的实现方式中,所述从根据所述匹配条目中输出端口信息确定的输出端口发送所述数据包,包括:根据哈希算法从所述输出端口信息中记录的多个端口中选择一个端口作为所述输出端口,并将所述数据包从所述输出端口进行转发。With reference to the first aspect or any one of the foregoing possible implementation manners, in a seventh possible implementation, the sending, by the output port determined according to the output port information in the matching entry, the data packet includes: according to The hash algorithm selects one of the plurality of ports recorded in the output port information as the output port, and forwards the data packet from the output port.
结合第一方面或以上任一项可能的实现方式,在第八种可能的实现方式中,所述匹配条目还包含操作信息,所述操作信息用于指示对所述数据包进行操作,则根据所述匹配条目中输出端口信息确定的输出端口转发发送所述数据包之前,进一步包括:根据所述匹配条目中的操作信息,对所述数据包进行操作。With reference to the first aspect or any of the foregoing possible implementations, in an eighth possible implementation, the matching entry further includes operation information, where the operation information is used to indicate that the data packet is operated, according to Before the output port determined by the output port information in the matching entry forwards and sends the data packet, the method further includes: operating the data packet according to the operation information in the matching entry.
结合第一方面或以上任一项可能的实现方式,在第九种可能的实现方式 中,所述地址运算符包括:不等于、大于、小于、大于等于或小于等于。In combination with the first aspect or any of the possible implementations, the ninth possible implementation The address operator includes: not equal to, greater than, less than, greater than or equal to, or less than or equal to.
第二方面,本发明实施例提供了一种路由方法,包括:In a second aspect, an embodiment of the present invention provides a routing method, including:
接收数据包,所述数据包中携带所述数据包的目的地址;Receiving a data packet, where the data packet carries a destination address of the data packet;
在路由表中确定与所述目的地址对应的匹配条目;Determining a matching entry corresponding to the destination address in the routing table;
根据地址信息按照所述匹配条目中输出端口信息进行运算的结果,确定所述输出端口,并将所述数据包从所述输出端口进行发送,所述地址信息包括以下至少一种:所述目的地址、所述数据包的源地址、所述匹配条目的网络标识和当前节点地址。And determining, according to the result that the address information is operated according to the output port information in the matching entry, the output port, and sending the data packet from the output port, where the address information includes at least one of the following: The address, the source address of the data packet, the network identifier of the matching entry, and the current node address.
结合第二方面,在第一种可能的实现方式中,所述路由表的条目中包含地址运算符和网络标识,所述匹配条目的网络标识的有效位与所述目的地址的有效位按照所述匹配条目的地址运算符进行运算的逻辑运算结果为真。With reference to the second aspect, in a first possible implementation, an entry of the routing table includes an address operator and a network identifier, where a valid bit of the network identifier of the matching entry and a valid bit of the destination address are in accordance with The result of the logical operation of the address operator of the matching entry is true.
结合第二方面或以上任一项可能的实现方式,在第二种可能的实现方式中,所述网络标识的有效位为将所述网络标识当做的一个整体数值,所述目的地址的有效位是指将所述目的地址当做的一个整体数值。With the second aspect or any of the foregoing possible implementation manners, in a second possible implementation manner, the valid bit of the network identifier is an overall value that is used as the network identifier, and a valid bit of the destination address It refers to the overall value of the destination address.
结合第二方面或以上任一项可能的实现方式,在第三种可能的实现方式中,所述路由表的条目中还包括掩码,所述目的地址的有效位为所述目的地址与所述掩码位与操作的结果当做的一个整体数值,所述网络标识的有效位为所述网络标识与所述掩码位与操作的结果当做的一个整体数值。With the second aspect or any of the foregoing possible implementations, in a third possible implementation, the entry of the routing table further includes a mask, where a valid bit of the destination address is the destination address and location The mask bit and the result of the operation are an overall value, and the valid bit of the network identifier is an overall value of the network identifier and the result of the mask bit and operation.
结合第二方面或以上任一项可能的实现方式,在第四种可能的实现方式中,所述掩码包括连续掩码和非连续掩码。With reference to the second aspect or any of the foregoing possible implementation manners, in a fourth possible implementation manner, the mask includes a continuous mask and a non-continuous mask.
结合第二方面或以上任一项可能的实现方式,在第五种可能的实现方式中,所述路由表的条目中还包括优先级信息,所述优先级信息用于指示所属条目的优先级;With reference to the second aspect or any of the foregoing possible implementation manners, in a fifth possible implementation manner, the entry of the routing table further includes priority information, where the priority information is used to indicate a priority of the belonging entry ;
所述在路由表中确定与所述目的地址对应的匹配条目,包括:在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,并根据所述查找到的条目的优先级信息,从所述查找到的条目中,选择优先级最高的条目,作为所述匹配条目。Determining, in the routing table, a matching entry corresponding to the destination address, comprising: a logic for finding a valid bit of the network identifier of the entry in the routing table and a valid bit of the destination address according to an address operator of the entry The operation result is an entry, and according to the priority information of the found entry, the entry with the highest priority is selected from the searched entry as the matching entry.
结合第二方面或以上任一项可能的实现方式,在第六种可能的实现方式中,所述在路由表中确定与所述目的地址对应的匹配条目,包括:按照优先级从高到低的顺序在路由表中查找条目的网络标识的有效位与所述目的地址 的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,将所述找到的第一个条目作为所述匹配条目,其中,所述查找表的条目按照优先级进行排序。With reference to the second aspect or any of the foregoing possible implementation manners, in a sixth possible implementation manner, the determining, in the routing table, a matching entry corresponding to the destination address, including: following a priority from high to low The order of finding the valid bit of the network identifier of the entry in the routing table and the destination address The valid bit is the entry of the logical operation whose operation is performed according to the address operator of the entry, and the first entry found is used as the matching entry, wherein the entries of the lookup table are sorted according to the priority.
结合第二方面或以上任一项可能的实现方式,在第七种可能的实现方式中,所述匹配条目还包含操作信息,所述操作信息用于指示对所述数据包进行操作,则根据所述匹配条目中输出端口信息确定的输出端口转发发送所述数据包之前,进一步包括:根据所述匹配条目中的操作信息,对所述数据包进行操作。With reference to the second aspect or any of the foregoing possible implementation manners, in a seventh possible implementation manner, the matching entry further includes operation information, where the operation information is used to indicate that the data packet is operated, according to Before the output port determined by the output port information in the matching entry forwards and sends the data packet, the method further includes: operating the data packet according to the operation information in the matching entry.
结合第二方面或以上任一项可能的实现方式,在第八种可能的实现方式中,所述地址运算符包括:不等于、大于、小于、大于等于或小于等于。With reference to the second aspect or any of the foregoing possible implementation manners, in an eighth possible implementation manner, the address operator includes: not equal to, greater than, less than, greater than or equal to, or less than or equal to.
第三方面,本发明实施例提供了一种用于路由的计算设备,包括:处理器、存储器、总线和通信接口;In a third aspect, an embodiment of the present invention provides a computing device for routing, including: a processor, a memory, a bus, and a communication interface;
所述存储器用于存储计算设备执行指令,所述处理器与所述存储器通过所述总线连接,当所述计算设备运行时,所述处理器执行所述存储器存储的所述计算机执行指令,以使所述计算设备执行第一方面或第一方面任一项可能的实现方式的方法,或执行第二方面或第二方面任一项可能的实现方式的方法。The memory is for storing a computing device execution instruction, the processor is coupled to the memory via the bus, and when the computing device is running, the processor executes the computer-executed instruction stored by the memory to A method of causing the computing device to perform the first aspect or any of the possible implementations of the first aspect, or the method of performing the second aspect or any of the possible implementations of the second aspect.
第四方面,本发明实施例提供了一种路由设备,包括:In a fourth aspect, an embodiment of the present invention provides a routing device, including:
接收单元,用于接收数据包,所述数据包中携带所述数据包的目的地址;a receiving unit, configured to receive a data packet, where the data packet carries a destination address of the data packet;
匹配单元,用于在路由表中确定与所述目的地址对应的匹配条目,其中,所述路由表的条目中包含地址运算符和网络标识,所述匹配条目的网络标识的有效位与所述目的地址的有效位按照所述匹配条目的地址运算符进行运算的逻辑运算结果为真;a matching unit, configured to determine, in the routing table, a matching entry corresponding to the destination address, where the entry of the routing table includes an address operator and a network identifier, and a valid bit of the network identifier of the matching entry is The logical operation result of the valid bit of the destination address being operated according to the address operator of the matching entry is true;
发送单元,用于从根据所述匹配条目中输出端口信息确定的输出端口发送所述数据包。And a sending unit, configured to send the data packet from an output port determined according to output port information in the matching entry.
结合第四方面,在第一种可能的实现方式中,所述网络标识的有效位为将所述网络标识当做的一个整体数值,所述目的地址的有效位是指将所述目的地址当做的一个整体数值。With reference to the fourth aspect, in a first possible implementation, the valid bit of the network identifier is an overall value that is used as the network identifier, and the valid bit of the destination address refers to the destination address. An overall value.
结合第四方面或以上任一项可能的实现方式,在第二种可能的实现方式中,所述路由表的条目中还包括掩码,所述目的地址的有效位为所述目的地址与所述掩码位与操作的结果当做的一个整体数值,所述网络标识的有效位 为所述网络标识与所述掩码位与操作的结果当做的一个整体数值。With reference to the fourth aspect or any of the foregoing possible implementation manners, in a second possible implementation manner, the entry of the routing table further includes a mask, where a valid bit of the destination address is the destination address and location The mask bit and the result of the operation as an overall value, the valid bit of the network identifier An overall value for the network identification and the result of the mask bit and operation.
结合第四方面或以上任一项可能的实现方式,在第三种可能的实现方式中,所述掩码包括连续掩码和非连续掩码。With reference to the fourth aspect or any of the foregoing possible implementation manners, in a third possible implementation manner, the mask includes a continuous mask and a non-continuous mask.
结合第四方面或以上任一项可能的实现方式,在第四种可能的实现方式中,所述路由表的条目中还包括优先级信息,所述优先级信息用于指示所属条目的优先级;With the fourth aspect or any of the foregoing possible implementation manners, in a fourth possible implementation manner, the entry of the routing table further includes priority information, where the priority information is used to indicate a priority of the belonging entry ;
所述匹配单元用于在路由表中确定与所述目的地址对应的匹配条目,包括:所述匹配单元在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,并根据所述查找到的条目的优先级信息,从所述查找到的条目中,选择优先级最高的条目,作为所述匹配条目。The matching unit is configured to determine, in the routing table, a matching entry corresponding to the destination address, including: the matching unit searches for a valid bit of the network identifier of the entry in the routing table, and a valid bit of the destination address according to the entry The logical operation result of the operation performed by the address operator is a true entry, and based on the priority information of the found entry, an entry having the highest priority is selected from the searched entry as the matching entry.
结合第四方面或以上任一项可能的实现方式,在第五种可能的实现方式中,所述匹配单元用于在路由表中确定与所述目的地址对应的匹配条目,包括:所述匹配单元按照优先级从高到低的顺序在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,将所述找到的第一个条目作为所述匹配条目,其中,所述查找表的条目按照优先级进行排序。With reference to the fourth aspect or any one of the foregoing possible implementation manners, in a fifth possible implementation, the matching unit is configured to determine, in the routing table, a matching entry corresponding to the destination address, including: the matching The unit searches for the valid bit of the network identifier of the entry in the order of priority from the highest priority in the order of priority, and the logical bit of the valid address of the destination address is calculated according to the address operator of the entry, and the logical operation result is true. The first entry found is used as the matching entry, wherein the entries of the lookup table are sorted according to priority.
结合第四方面或以上任一项可能的实现方式,在第六种可能的实现方式中,所述发送单元用于从根据所述匹配条目中的输出端口信息确定的输出端口发送所述数据包包括:所述发送单元根据地址信息按照所述匹配条目中输出端口信息进行运算的结果,确定所述输出端口,并将所述数据包从所述输出端口进行发送,所述地址信息包括以下至少一种:所述目的地址、所述数据包的源地址、所述匹配条目的网络标识和当前节点地址。With reference to the fourth aspect or any one of the foregoing possible implementation manners, in a sixth possible implementation, the sending unit is configured to send the data packet from an output port determined according to output port information in the matching entry The method includes: the sending unit determines, according to the result that the address information is operated according to the output port information in the matching entry, the output port, and sends the data packet from the output port, where the address information includes at least the following A: the destination address, a source address of the data packet, a network identifier of the matching entry, and a current node address.
结合第四方面或以上任一项可能的实现方式,在第七种可能的实现方式中,所述发送单元用于从根据所述匹配条目中的输出端口信息确定的输出端口发送所述数据包包括:所述发送单元根据哈希算法从所述输出端口信息中记录的多个端口中选择一个端口作为所述输出端口,并将所述数据包从所述输出端口进行转发。With reference to the fourth aspect or any one of the foregoing possible implementation manners, in a seventh possible implementation, the sending unit is configured to send the data packet from an output port determined according to output port information in the matching entry The method includes: the sending unit selects one port from the plurality of ports recorded in the output port information as the output port according to a hash algorithm, and forwards the data packet from the output port.
结合第四方面或以上任一项可能的实现方式,在第八种可能的实现方式中,所述设备还包括操作单元,所述匹配条目还包含操作信息,所述操作信息用于指示对所述数据包进行操作,所述操作单元用于根据所述匹配条目中 的操作信息,对所述数据包进行操作。With reference to the fourth aspect or any one of the foregoing possible implementation manners, in an eighth possible implementation manner, the device further includes an operation unit, the matching entry further includes operation information, where the operation information is used to indicate a The data packet is operated, and the operating unit is configured to be used according to the matching entry Operation information, operating on the data packet.
结合第四方面或以上任一项可能的实现方式,在第九种可能的实现方式中,所述地址运算符包括:不等于、大于、小于、大于等于或小于等于。With reference to the fourth aspect or any of the foregoing possible implementation manners, in the ninth possible implementation manner, the address operator includes: not equal to, greater than, less than, greater than or equal to, or less than or equal to.
第五方面,本发明实施例提供了一种路由设备,包括:In a fifth aspect, an embodiment of the present invention provides a routing device, including:
接收单元,用于接收数据包,所述数据包中携带所述数据包的目的地址;a receiving unit, configured to receive a data packet, where the data packet carries a destination address of the data packet;
匹配单元,用于在路由表中确定与所述目的地址对应的匹配条目;a matching unit, configured to determine, in the routing table, a matching entry corresponding to the destination address;
发送单元,用于根据地址信息按照所述匹配条目中输出端口信息进行运算的结果,确定所述输出端口,并将所述数据包从所述输出端口进行发送,所述地址信息包括以下至少一种:所述目的地址、所述数据包的源地址、所述匹配条目的网络标识和当前节点地址。a sending unit, configured to determine, according to the result that the address information is operated according to the output port information in the matching entry, the output port, and send the data packet from the output port, where the address information includes at least one of the following The destination address, the source address of the data packet, the network identifier of the matching entry, and the current node address.
结合第五方面,在第一种可能的实现方式中,所述路由表的条目中包含地址运算符和网络标识,所述匹配条目的网络标识的有效位与所述目的地址的有效位按照所述匹配条目的地址运算符进行运算的逻辑运算结果为真。With reference to the fifth aspect, in a first possible implementation, an entry of the routing table includes an address operator and a network identifier, where a valid bit of the network identifier of the matching entry and a valid bit of the destination address are in accordance with The result of the logical operation of the address operator of the matching entry is true.
结合第五方面或以上任一项可能的实现方式,在第二种可能的实现方式中,所述网络标识的有效位为将所述网络标识当做的一个整体数值,所述目的地址的有效位是指将所述目的地址当做的一个整体数值。With reference to the fifth aspect or any of the foregoing possible implementation manners, in a second possible implementation manner, the valid bit of the network identifier is an overall value that is used as the network identifier, and a valid bit of the destination address It refers to the overall value of the destination address.
结合第五方面或以上任一项可能的实现方式,在第三种可能的实现方式中,所述路由表的条目中还包括掩码,所述目的地址的有效位为所述目的地址与所述掩码位与操作的结果当做的一个整体数值,所述网络标识的有效位为所述网络标识与所述掩码位与操作的结果当做的一个整体数值。With reference to the fifth aspect or any one of the foregoing possible implementation manners, in a third possible implementation manner, the entry of the routing table further includes a mask, where a valid bit of the destination address is the destination address and the location The mask bit and the result of the operation are an overall value, and the valid bit of the network identifier is an overall value of the network identifier and the result of the mask bit and operation.
结合第五方面或以上任一项可能的实现方式,在第四种可能的实现方式中,所述掩码包括连续掩码和非连续掩码。With reference to the fifth aspect or any of the foregoing possible implementation manners, in a fourth possible implementation manner, the mask includes a continuous mask and a non-continuous mask.
结合第五方面或以上任一项可能的实现方式,在第五种可能的实现方式中,所述路由表的条目中还包括优先级信息,所述优先级信息用于指示所属条目的优先级;With the fifth aspect or any of the foregoing possible implementation manners, in a fifth possible implementation manner, the entry of the routing table further includes priority information, where the priority information is used to indicate a priority of the belonging entry ;
所述匹配单元用于在路由表中确定与所述目的地址对应的匹配条目,包括:所述匹配单元在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,并根据所述查找到的条目的优先级信息,从所述查找到的条目中,选择优先级最高的条目,作为所述匹配条目。The matching unit is configured to determine, in the routing table, a matching entry corresponding to the destination address, including: the matching unit searches for a valid bit of the network identifier of the entry in the routing table, and a valid bit of the destination address according to the entry The logical operation result of the operation performed by the address operator is a true entry, and based on the priority information of the found entry, an entry having the highest priority is selected from the searched entry as the matching entry.
结合第五方面或以上任一项可能的实现方式,在第六种可能的实现方式 中,所述匹配单元用于在路由表中确定与所述目的地址对应的匹配条目,包括:所述匹配单元按照优先级从高到低的顺序在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,将所述找到的第一个条目作为所述匹配条目,其中,所述查找表的条目按照优先级进行排序。In combination with the fifth aspect or any of the possible implementations, in a sixth possible implementation The matching unit is configured to determine, in the routing table, a matching entry corresponding to the destination address, where the matching unit searches for a valid bit of the network identifier of the entry in the routing table according to a priority from highest to lowest priority. An entry that is a logical operation that operates with the valid bit of the destination address in accordance with the address operator of the entry, and the first entry found as the matching entry, wherein the entry of the lookup table is Priority is sorted.
结合第五方面或以上任一项可能的实现方式,在第七种可能的实现方式中,所述设备还包括操作单元,所述匹配条目还包含操作信息,所述操作信息用于指示对所述数据包进行操作,所述操作单元用于根据所述匹配条目中的操作信息,对所述数据包进行操作。With reference to the fifth aspect or any one of the foregoing possible implementation manners, in a seventh possible implementation manner, the device further includes an operation unit, where the matching item further includes operation information, where the operation information is used to indicate a The data packet is operated, and the operation unit is configured to operate the data packet according to the operation information in the matching entry.
结合第五方面或以上任一项可能的实现方式,在第八种可能的实现方式中,所述地址运算符包括:等于、不等于、大于、小于、大于等于或小于等于。With reference to the fifth aspect or any of the foregoing possible implementation manners, in the eighth possible implementation manner, the address operator includes: equal to, not equal to, greater than, less than, greater than or equal to, or less than or equal to.
可选的,以上任一方面或任一方面的任一可能的实现方式中,网络标识包括但不限于MAC地址、IP地址等。Optionally, in any of the foregoing possible implementation manners, the network identifier includes, but is not limited to, a MAC address, an IP address, and the like.
可选的,以上任一方面或任一方面的任一可能的实现方式中,OP两边的比较项各自作为一个整体数值进行比较。Optionally, in any one of the foregoing aspects or any of the possible implementations, the comparison items on both sides of the OP are compared as a whole value.
可选的,以上任一方面或任一方面的任一可能的实现方式中,OP两边的比较项可以从第1维到第n维呈高字节到低字节顺序排列或从第1维到第n维呈低字节到高字节顺序排列。Optionally, in any one of the foregoing aspects or any of the possible implementations, the comparison items on both sides of the OP may be in the order of the first byte to the nth dimension from the high byte to the low byte or from the first dimension. Arrange from the low byte to the high byte order in the nth dimension.
可选的,以上任一方面或任一方面的任一可能的实现方式中,OP两边的比较项还可以各自从n维标签中选择其中的m维标签作为一个整体数值进行比较,该m维标签从第1维到第m维呈高字节到低字节顺序排列或从第1维到第m维呈低字节到高字节顺序排列。Optionally, in any of the foregoing possible implementation manners, the comparison items on both sides of the OP may further select an m-dimensional label from the n-dimensional labels as an overall value, where the m-dimension The labels are arranged from the 1st dimension to the mth dimension in the order of the high byte to the low byte or from the 1st dimension to the mth dimension in the low byte to the high byte order.
可选的,以上任一方面或任一方面的任一可能的实现方式中,优先级可以是一个数值,用以标识查找表条目的优先级高低,可以是数值越大优先级越高,也可以是数值越小优先级越高。优先级也可以是其他能够区别大小或顺序的表达方式,比如英文字符等。Optionally, in any one of the foregoing possible implementation manners, the priority may be a value that is used to identify the priority of the lookup table entry, and the greater the value, the higher the priority. It can be that the smaller the value, the higher the priority. The priority can also be other expressions that can distinguish between size or order, such as English characters.
可选的,以上任一方面或任一方面的任一可能的实现方式中,查找表中的条目按照优先级从高到低或者从低到高的顺序排列。Optionally, in any one of the foregoing aspects or any of the possible implementations, the entries in the lookup table are arranged in descending order of priority or low to high.
可选的,输出端口算法支持加、减、乘、除、移位等所有的数学运算符中的至少一种。 Optionally, the output port algorithm supports at least one of all mathematical operators such as addition, subtraction, multiplication, division, and shift.
根据本实施例提供的技术方案,通过给查找表条目增加运算字段,增强了查找表条目的表达能力,提高了查找表条目的聚合能力。从而减小了查找表的规模,降低了片上存储需求,减小了芯片面积、成本、查表时间及功耗,提高了网络规模可扩展性。According to the technical solution provided by the embodiment, by adding an operation field to the lookup table entry, the expression capability of the lookup table entry is enhanced, and the aggregation capability of the lookup table entry is improved. Thereby reducing the size of the lookup table, reducing on-chip storage requirements, reducing chip area, cost, table lookup time and power consumption, and improving network scale scalability.
附图说明DRAWINGS
为了更清楚地说明本发明实施例的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present invention, Those skilled in the art can also obtain other drawings based on these drawings without paying any creative work.
图1为一路由方法应用场景的系统逻辑结构示意图;1 is a schematic diagram of a system logical structure of a routing method application scenario;
图2为一路由方法应用场景的系统逻辑结构示意图;2 is a schematic diagram of a system logical structure of a routing method application scenario;
图3为依据本发明一实施例的路由方法的示范性流程图;3 is an exemplary flowchart of a routing method according to an embodiment of the invention;
图4为依据本发明一实施例的路由方法的示范性流程图;4 is an exemplary flowchart of a routing method according to an embodiment of the present invention;
图5为依据本发明一实施例的查找表示意图;FIG. 5 is a schematic diagram of a lookup table according to an embodiment of the invention; FIG.
图6为依据本发明一实施例的路由方法应用场景的系统逻辑结构示意图;6 is a schematic diagram of a system logical structure of a routing method application scenario according to an embodiment of the invention;
图7为依据本发明一实施例的路由方法应用场景的系统逻辑结构示意图;FIG. 7 is a schematic diagram of a system logical structure of a routing method application scenario according to an embodiment of the invention; FIG.
图8为依据本发明一实施例的路由方法应用场景的系统逻辑结构示意图;FIG. 8 is a schematic diagram of a system logical structure of a routing method application scenario according to an embodiment of the invention; FIG.
图9为依据本发明一实施例的路由设备的逻辑结构示意图;FIG. 9 is a schematic diagram showing the logical structure of a routing device according to an embodiment of the invention; FIG.
图10为依据本发明一实施例的路由设备的逻辑结构示意图;FIG. 10 is a schematic diagram showing the logical structure of a routing device according to an embodiment of the invention; FIG.
图11为依据本发明一实施例的路由系统硬件结构示意图。FIG. 11 is a schematic structural diagram of a hardware of a routing system according to an embodiment of the invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。 The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are a part of the embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
图1为本发明一个路由方法应用场景的系统逻辑结构示意图。如图1所示,网络设备2采用最长前缀匹配技术对数据包进行转发,该技术通过聚合具有相同网络标识前缀和输出的查找表条目实现查找表的压缩,在接收到数据包后,通过最长前缀匹配技术实现匹配条目的查找。FIG. 1 is a schematic diagram of a system logical structure of a routing method application scenario according to the present invention. As shown in FIG. 1, the network device 2 forwards the data packet by using the longest prefix matching technology. The technology implements compression of the lookup table by aggregating lookup table entries having the same network identifier prefix and output, and after receiving the data packet, The longest prefix matching technique implements the lookup of matching entries.
可选的,网络设备2包括但不限于路由器、交换机等;所述网络标识包括但不限于网际协议互联网协议(Internet Protocol,简称IP)地址、硬件媒体接入控制(Media Access Control,简称MAC)地址等。Optionally, the network device 2 includes, but is not limited to, a router, a switch, and the like. The network identifier includes, but is not limited to, an Internet Protocol (IP) address, and a Media Access Control (MAC). Address, etc.
该技术使用查找表的一般结构如图1所示。查找表的每个表条目包括匹配域和动作域两部分。匹配域包括网络标识,或包含网络标识和掩码,用于实现查表时的条目匹配。其中,网络标识可以是任意地址标签,一般的表示形式可以为A1.A2.….An;掩码为前缀连续掩码。动作域包含数据包操作信息,一般至少包括输出端口信息。为了减小查找表规模,使用基于网络地址聚合的压缩技术——将具有相同网络标识前缀和输出的查找表条目合并为一个条目,对查找表进行压缩。如图1所示,通过聚合具有相同网络标识前缀和输出的表条目可以将网络设备2的原始查找表的6个表条目压缩为4个,从而实现查找表压缩的目的。The general structure of the technique using a lookup table is shown in Figure 1. Each table entry of the lookup table includes a matching domain and an action domain. The matching domain includes the network identifier, or contains the network identifier and mask, which are used to implement matching of entries when looking up the table. The network identifier may be any address label, and the general representation may be A1.A2.....An; the mask is a prefix continuous mask. The action field contains packet operation information, and generally includes at least output port information. In order to reduce the lookup table size, a network address aggregation based compression technique is used - the lookup table entries with the same network identification prefix and output are combined into one entry to compress the lookup table. As shown in FIG. 1, by aggregating table entries having the same network identifier prefix and output, the six table entries of the original lookup table of the network device 2 can be compressed into four, thereby achieving the purpose of the lookup table compression.
如图1所示,网络设备2接收到网络C发送的数据包后,从数据包提取数据包的目的节点的IP地址信息,目的IP地址为100.50.10.6,根据压缩后的查找表,基于匹配条件“(目的地址&掩码)==(网络标识&掩码)”执行路由查找,从压缩后的查找表查找与目的IP地址匹配的条目。如果存在匹配的表条目,从所有匹配的表条目中选择具有最长网络标识前缀的条目作为最终匹配条目,如果没有匹配条目,则执行网络设备设定的默认操作。如图1所示,查找表的第3和第4个表条目与IP地址匹配,基于最长前缀匹配原则,选择第4个表条目作为最终配条目,从最终匹配的表条目中提取输出端口等信息,以为数据包处理(比如,转发)提供信息,在图1中,网络设备2将从网络C接收的数据包从端口3转发出去,从而实现数据包的路由。As shown in FIG. 1 , after receiving the data packet sent by the network C, the network device 2 extracts the IP address information of the destination node of the data packet from the data packet, and the destination IP address is 100.50.10.6, according to the compressed lookup table, based on the matching. The condition "(destination address & mask) == (network identification & mask)" performs route lookup, and looks up the entry matching the destination IP address from the compressed lookup table. If there is a matching table entry, the entry with the longest network identification prefix is selected from all matching table entries as the final matching entry, and if there is no matching entry, the default operation set by the network device is performed. As shown in Figure 1, the 3rd and 4th table entries of the lookup table match the IP address. Based on the longest prefix matching principle, the 4th table entry is selected as the final matching entry, and the output port is extracted from the final matching table entry. The information is such that information is provided for packet processing (eg, forwarding). In FIG. 1, the network device 2 forwards the data packet received from the network C from the port 3, thereby implementing routing of the data packet.
图1中的基于最长前缀匹配的查表路由技术对于简单的分层聚合网络的路由算法的执行是高效的,但对于很多高性能网络的路由算法的执行是低效的,不能实现对查找表的有效压缩,甚至不能执行。图2是一路由方 法应用场景的系统逻辑结构示意图,如图2所示,所示网络是高性能计算机和数据中心中一种非常重要的网络——胖树,在该图中胖树网络使用目的地址路由(Dst-Routing)算法,并利用上述传统查表路由技术对该路由算法进行实现,来执行数据包的路由查找。胖树Dst-Routing路由算法是一种向上/向下路由(Up-Down Routing),其路由规则是:当源主机节点向目的主机节点发送数据包时,数据包首先从源节点出发,一直向上路由和转发到源和目的主机交换节点的最近公共祖先交换节点(交换机或路由器),然后进入向下路由和转发阶段,一直向下路由和转发到目的主机节点。在向上和向下路由时,交换节点的输出端口号由目的主机节点的目的地址和交换节点所在层号确定。The lookup table routing technology based on the longest prefix matching in Figure 1 is efficient for the execution of routing algorithms for simple hierarchical aggregation networks, but the execution of routing algorithms for many high performance networks is inefficient and cannot be searched. The table is effectively compressed and cannot even be executed. Figure 2 is a routing party Schematic diagram of the system logic structure of the application scenario, as shown in Figure 2, the network shown is a very important network in high-performance computers and data centers - fat tree, in which the fat tree network uses destination address routing (Dst -Routing) algorithm, and implementing the routing algorithm by using the above traditional table lookup routing technology to perform route lookup of the data packet. The fat tree Dst-Routing routing algorithm is an Up-Down Routing. The routing rule is: when the source host node sends a data packet to the destination host node, the data packet starts from the source node and continues upward. Routing and forwarding to the nearest public ancestor switching node (switch or router) of the source and destination host switching nodes, then entering the down-route and forwarding phase, routing down and forwarding to the destination host node. When routing up and down, the output port number of the switching node is determined by the destination address of the destination host node and the layer number of the switching node.
可选的,当胖树按照图2方式对交换机和主机节点编址,如果数据包的目的主机节点网络标识为A1.A2.….An,数据包当前到达的交换节点所在层号为L,则向上路由时选择端口M/2+An-L作为输出端口号,向下路由时选择An-L作为输出端口号,其中n为胖树层数,M为交换节点端口数。Optionally, when the fat tree addresses the switch and the host node according to the method of FIG. 2, if the destination host node network identifier of the data packet is A1.A2.....An, the layer number of the switching node currently arriving by the data packet is L, Then, when the route is up, the port M/2+An-L is selected as the output port number, and when the route is routed, An-L is selected as the output port number, where n is the number of fat tree layers and M is the number of switching node ports.
如图2所示,利用基于最长前缀匹配的查表路由技术实现胖树Dst-Routing路由算法时,假设数据包从源节点1.0.0传送到目的节点3.1.1,其路由路径经过交换节点1.1.3,交换节点1.1.3的查找表如表1所示,As shown in Figure 2, when the fat tree Dst-Routing routing algorithm is implemented by using the table lookup routing technology based on the longest prefix matching, it is assumed that the data packet is transmitted from the source node 1.0.0 to the destination node 3.1.1, and the routing path passes through the switching node. 1.1.3, the lookup table of the switching node 1.1.3 is shown in Table 1,
表1Table 1
网络标识Network identification 掩码Mask 输出端口Output port ...
1.0.01.0.0 255.255.0255.255.0 00 ...
1.1.01.1.0 255.255.0255.255.0 11 ...
0.0.00.0.0 255.255.0255.255.0 22 ...
0.1.00.1.0 255.255.0255.255.0 33 ...
2.0.02.0.0 255.255.0255.255.0 22 ...
2.1.02.1.0 255.255.0255.255.0 33 ...
3.0.03.0.0 255.255.0255.255.0 22 ...
3.1.03.1.0 255.255.0255.255.0 33 ...
基于匹配条件“(目的地址&掩码)==(网络标识&掩码)”执行路由查找,可知表1的最后一个条目的逻辑运算结果为真,表示匹配,匹配的最后一个条目的输出端口为端口3,交换节点1.1.3将数据包从输出端口3转发。由表1可知,网络设备节点<1.1.3>的查找表的表条目数(8条)远多于交换机的端口数(4个),相比无压缩情况(16条,即等于主机节点数), 仅实现了50%的压缩。当网络规模扩展到数十万节点规模时,表大小和查表效率将成为严重的问题。因此,利用最长前缀匹配查表路由技术实现胖树Dst-Routing是非常低效的,不能实现有效的查找表压缩。其低效的根源是受限的查找表条目表达能力,使得表条目不能高效地聚合。Performing a route lookup based on the matching condition "(destination address & mask) == (network identifier & mask)", it can be seen that the logical operation result of the last entry of Table 1 is true, indicating that the matching, the output port of the last entry of the match For port 3, switching node 1.1.3 forwards the packet from output port 3. As can be seen from Table 1, the number of table entries (8) of the lookup table of the network device node <1.1.3> is far more than the number of ports of the switch (4), compared with no compression (16, which is equal to the number of host nodes) ), Only 50% compression is achieved. When the network scale is extended to hundreds of thousands of node sizes, table size and table lookup efficiency will become serious problems. Therefore, using the longest prefix matching table lookup routing technology to implement fat tree Dst-Routing is very inefficient and cannot achieve efficient lookup table compression. The inefficiency of the root cause is the limited ability to express lookup table entries, making table entries not efficiently aggregated.
图3为依据本发明一实施例的路由方法300的示范性流程图,以实现更有效的路由转发。在具体实现过程中,路由方法300可以由例如但不限于路由器或交换机执行。如图3所示,该方法300具体为:3 is an exemplary flow diagram of a routing method 300 to achieve more efficient routing forwarding in accordance with an embodiment of the present invention. In a particular implementation, routing method 300 can be performed by, for example, but not limited to, a router or switch. As shown in FIG. 3, the method 300 is specifically as follows:
S302:接收数据包,所述数据包中携带所述数据包的目的地址。S302: Receive a data packet, where the data packet carries a destination address of the data packet.
S304:在路由表中确定与所述目的地址对应的匹配条目,其中,所述路由表的条目中包含地址运算符和网络标识,所述匹配条目的网络标识的有效位与所述目的地址的有效位按照所述匹配条目的地址运算符进行运算的逻辑运算结果为真。S304: Determine, in the routing table, a matching entry corresponding to the destination address, where the entry of the routing table includes an address operator and a network identifier, where a valid bit of the network identifier of the matching entry is related to the destination address The logical operation result of the valid bit operation according to the address operator of the matching entry is true.
S306:从根据所述匹配条目中输出端口信息确定的输出端口发送所述数据包。S306: Send the data packet from an output port determined according to output port information in the matching entry.
可选的,网络标识包括但不限于MAC地址、IP地址等。Optionally, the network identifier includes but is not limited to a MAC address, an IP address, and the like.
可选的,该地址运算符包括但不限于等于(==)、不等于(≠)、大于(>)、小于(<)、大于等于(≥)和小于等于(≤)等关系比较操作。Optionally, the address operator includes, but is not limited to, a relational comparison operation equal to (==), not equal to (≠), greater than (>), less than (<), greater than or equal to (≥), and less than or equal to (≤).
可选的,所述网络标识的有效位为将所述网络标识当做的一个整体数值,所述目的地址的有效位是指将所述目的地址当做的一个整体数值。例如,将IP地址11.12.14.10,作为数值11121410来看。从而可以按照地址运算符进行运算。Optionally, the valid bit of the network identifier is an overall value that is used to treat the network identifier, and the valid bit of the destination address refers to an overall value that is used as the destination address. For example, the IP address 11.12.14.10 is taken as the value 11121410. Thus, operations can be performed in accordance with the address operator.
可选的,所述路由表的条目中还包括掩码,所述目的地址的有效位为所述目的地址与所述掩码位与操作的结果当做的一个整体数值,所述网络标识的有效位为所述网络标识与所述掩码位与操作的结果当做的一个整体数值。Optionally, the entry of the routing table further includes a mask, where a valid bit of the destination address is an overall value of the destination address and the mask bit and the result of the operation, and the network identifier is valid. The bit is an overall value of the network identification and the result of the mask bit and operation.
可选的,为了增强掩码操作后网络标识的表达能力,所述掩码包括连续掩码和非连续掩码,例如255.0.255.0。Optionally, in order to enhance the expressive capability of the network identifier after the mask operation, the mask includes a continuous mask and a non-continuous mask, for example, 255.0.255.0.
可选的,地址运算符两边的比较项各自作为一个整体数值进行比较。Optionally, the comparison terms on both sides of the address operator are each compared as an integer value.
可选的,地址运算符的比较项可以从第1维到第n维呈高字节到低字 节顺序排列或从第1维到第n维呈低字节到高字节顺序排列。Optionally, the comparison term of the address operator can be from high byte to low word from the first dimension to the nth dimension. The order of the sections is arranged in order from the first dimension to the nth dimension from the low byte to the high byte order.
可选的,地址运算符的比较项还可以各自从n维标签中选择其中的m维标签作为一个整体数值进行比较,该m维标签从第1维到第m维呈高字节到低字节顺序排列或从第1维到第m维呈低字节到高字节顺序排列。Optionally, the comparison item of the address operator may further select an m-dimensional label from the n-dimensional label as an overall value, and the m-dimensional label is a high byte to a low word from the first dimension to the mth dimension. The order is arranged in order from the first dimension to the mth dimension in descending order of high byte order.
可选的,所述路由表的条目中还包括优先级信息,所述优先级信息用于指示所属条目的优先级;Optionally, the entry of the routing table further includes priority information, where the priority information is used to indicate a priority of the belonging entry;
所述在路由表中确定与所述目的地址对应的匹配条目,包括:在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,并根据所述查找到的条目的优先级信息,从所述查找到的条目中,选择优先级最高的条目,作为所述匹配条目。Determining, in the routing table, a matching entry corresponding to the destination address, comprising: a logic for finding a valid bit of the network identifier of the entry in the routing table and a valid bit of the destination address according to an address operator of the entry The operation result is an entry, and according to the priority information of the found entry, the entry with the highest priority is selected from the searched entry as the matching entry.
可选的,优先级可以是一个数值,用以标识查找表条目的优先级高低,可以是数值越大优先级越高,也可以是数值越小优先级越高。优先级也可以是其他能够区别大小或顺序的表达方式,比如英文字符等。Optionally, the priority may be a value to identify the priority of the lookup table entry. The greater the value, the higher the priority, or the smaller the value, the higher the priority. The priority can also be other expressions that can distinguish between size or order, such as English characters.
可选的,所述在路由表中确定与所述目的地址对应的匹配条目,包括:按照优先级从高到低的顺序在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,将所述找到的第一个条目作为所述匹配条目,其中,所述查找表的条目按照优先级进行排序。Optionally, the determining, in the routing table, the matching entry corresponding to the destination address, including: searching for a valid bit of the network identifier of the entry in the routing table according to a priority from highest to lowest, and the destination address. The entry of the valid bit according to the address operator of the entry is a true entry, and the first entry found is used as the match entry, wherein the entries of the lookup table are sorted according to priority.
可选的,所述从根据所述匹配条目中的输出端口信息确定的输出端口发送所述数据包包括:根据地址信息按照所述匹配条目中输出端口信息进行运算的结果,确定所述输出端口,并将所述数据包从所述输出端口进行发送,所述地址信息包括以下至少一种:所述目的地址、所述数据包的源地址、所述匹配条目的网络标识和当前节点地址。Optionally, the sending, by the output port determined according to the output port information in the matching entry, the data packet comprises: determining, according to the result of the operation, outputting the port information according to the address information, determining the output port And transmitting the data packet from the output port, the address information comprising at least one of the following: the destination address, a source address of the data packet, a network identifier of the matching entry, and a current node address.
可选的,所述从根据所述匹配条目中输出端口信息确定的输出端口发送所述数据包,包括:根据哈希算法从所述输出端口信息中记录的多个端口中选择一个端口作为所述输出端口,并将所述数据包从所述输出端口进行转发。Optionally, the sending the data packet from the output port determined according to the output port information in the matching entry, including: selecting one port from the multiple ports recorded in the output port information according to a hash algorithm Describe the output port and forward the data packet from the output port.
可选的,输出端口算法支持加、减、乘、除、移位等所有的数学运算符中的至少一种。 Optionally, the output port algorithm supports at least one of all mathematical operators such as addition, subtraction, multiplication, division, and shift.
可选的,所述匹配条目还包含操作信息,所述操作信息用于指示对所述数据包进行操作,则根据所述匹配条目中输出端口信息确定的输出端口转发发送所述数据包之前,进一步包括:根据所述匹配条目中的操作信息,对所述数据包进行操作。Optionally, the matching entry further includes operation information, where the operation information is used to indicate that the data packet is operated, and the output port determined according to the output port information in the matching entry is forwarded before sending the data packet. Further comprising: operating the data packet according to the operation information in the matching entry.
根据本实施例提供的技术方案,通过给查找表条目增加运算字段,增强了查找表条目的表达能力,提高了查找表条目的聚合能力。从而减小了查找表的规模,降低了片上存储需求,减小了芯片面积、成本、查表时间及功耗,提高了网络规模可扩展性。According to the technical solution provided by the embodiment, by adding an operation field to the lookup table entry, the expression capability of the lookup table entry is enhanced, and the aggregation capability of the lookup table entry is improved. Thereby reducing the size of the lookup table, reducing on-chip storage requirements, reducing chip area, cost, table lookup time and power consumption, and improving network scale scalability.
图4为依据本发明一实施例的路由方法400的示范性流程图,以实现更有效的路由转发。在具体实现过程中,路由方法400可以由例如但不限于路由器或交换机执行。如图4所示,该方法400具体为:4 is an exemplary flow diagram of a routing method 400 to enable more efficient routing forwarding in accordance with an embodiment of the present invention. In a particular implementation, routing method 400 can be performed by, for example, but not limited to, a router or switch. As shown in FIG. 4, the method 400 is specifically:
S402:接收数据包,所述数据包中携带所述数据包的目的地址。S402: Receive a data packet, where the data packet carries a destination address of the data packet.
S404:在路由表中确定与所述目的地址对应的匹配条目。S404: Determine a matching entry corresponding to the destination address in the routing table.
S406:根据地址信息按照所述匹配条目中输出端口信息进行运算的结果,确定所述输出端口,并将所述数据包从所述输出端口进行发送,所述地址信息包括以下至少一种:所述目的地址、所述数据包的源地址、所述匹配条目的网络标识和当前节点地址。S406: Determine, according to the result that the address information is operated according to the output port information in the matching entry, the output port, and send the data packet from the output port, where the address information includes at least one of the following: Describe the destination address, the source address of the data packet, the network identifier of the matching entry, and the current node address.
可选的,输出端口算法支持加、减、乘、除、移位等所有的数学运算符中的至少一种。Optionally, the output port algorithm supports at least one of all mathematical operators such as addition, subtraction, multiplication, division, and shift.
可选的,所述路由表的条目中包含地址运算符和网络标识,所述匹配条目的网络标识的有效位与所述目的地址的有效位按照所述匹配条目的地址运算符进行运算的逻辑运算结果为真。Optionally, the entry of the routing table includes an address operator and a network identifier, and the logic of the valid bit of the network identifier of the matching entry and the valid bit of the destination address are operated according to the address operator of the matching entry. The result of the operation is true.
可选的,所述网络标识的有效位为将所述网络标识当做的一个整体数值,所述目的地址的有效位是指将所述目的地址当做的一个整体数值。Optionally, the valid bit of the network identifier is an overall value that is used to treat the network identifier, and the valid bit of the destination address refers to an overall value that is used as the destination address.
可选的,所述路由表的条目中还包括掩码,所述目的地址的有效位为所述目的地址与所述掩码位与操作的结果当做的一个整体数值,所述网络标识的有效位为所述网络标识与所述掩码位与操作的结果当做的一个整体数值。Optionally, the entry of the routing table further includes a mask, where a valid bit of the destination address is an overall value of the destination address and the mask bit and the result of the operation, and the network identifier is valid. The bit is an overall value of the network identification and the result of the mask bit and operation.
可选的,为了增强掩码操作后网络标识的表达能力,所述掩码包括连 续掩码和非连续掩码,例如255.0.255.0。Optionally, in order to enhance the expressive capability of the network identifier after the mask operation, the mask includes Continued mask and non-continuous mask, for example 255.0.255.0.
可选的,地址运算符两边的比较项各自作为一个整体数值进行比较。Optionally, the comparison terms on both sides of the address operator are each compared as an integer value.
可选的,地址运算符的比较项可以从第1维到第n维呈高字节到低字节顺序排列或从第1维到第n维呈低字节到高字节顺序排列。Optionally, the comparison term of the address operator may be arranged from the first byte to the nth dimension in a high byte to a low byte order or from the first dimension to the nth dimension in a low byte to a high byte order.
可选的,地址运算符的比较项还可以各自从n维标签中选择其中的m维标签作为一个整体数值进行比较,该m维标签从第1维到第m维呈高字节到低字节顺序排列或从第1维到第m维呈低字节到高字节顺序排列。Optionally, the comparison item of the address operator may further select an m-dimensional label from the n-dimensional label as an overall value, and the m-dimensional label is a high byte to a low word from the first dimension to the mth dimension. The order is arranged in order from the first dimension to the mth dimension in descending order of high byte order.
可选的,所述路由表的条目中还包括优先级信息,所述优先级信息用于指示所属条目的优先级;Optionally, the entry of the routing table further includes priority information, where the priority information is used to indicate a priority of the belonging entry;
所述在路由表中确定与所述目的地址对应的匹配条目,包括:在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,并根据所述查找到的条目的优先级信息,从所述查找到的条目中,选择优先级最高的条目,作为所述匹配条目。Determining, in the routing table, a matching entry corresponding to the destination address, comprising: a logic for finding a valid bit of the network identifier of the entry in the routing table and a valid bit of the destination address according to an address operator of the entry The operation result is an entry, and according to the priority information of the found entry, the entry with the highest priority is selected from the searched entry as the matching entry.
可选的,所述在路由表中确定与所述目的地址对应的匹配条目,包括:按照优先级从高到低的顺序在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,将所述找到的第一个条目作为所述匹配条目,其中,所述查找表的条目按照优先级进行排序。Optionally, the determining, in the routing table, the matching entry corresponding to the destination address, including: searching for a valid bit of the network identifier of the entry in the routing table according to a priority from highest to lowest, and the destination address. The entry of the valid bit according to the address operator of the entry is a true entry, and the first entry found is used as the match entry, wherein the entries of the lookup table are sorted according to priority.
可选的,所述匹配条目还包含操作信息,所述操作信息用于指示对所述数据包进行操作,则根据所述匹配条目中输出端口信息确定的输出端口转发发送所述数据包之前,进一步包括:根据所述匹配条目中的操作信息,对所述数据包进行操作。Optionally, the matching entry further includes operation information, where the operation information is used to indicate that the data packet is operated, and the output port determined according to the output port information in the matching entry is forwarded before sending the data packet. Further comprising: operating the data packet according to the operation information in the matching entry.
可选的,可选的,该地址运算符包括但不限于等于(==)、不等于(≠)、大于(>)、小于(<)、大于等于(≥)和小于等于(≤)等关系比较操作。Optionally, optionally, the address operator includes, but is not limited to, equal to (==), not equal to (≠), greater than (>), less than (<), greater than or equal to (≥), and less than or equal to (≤), etc. Relationship comparison operation.
可选的,网络标识包括但不限于MAC地址、IP地址等。Optionally, the network identifier includes but is not limited to a MAC address, an IP address, and the like.
根据本实施例提供的技术方案,通过给查找表条目增加运算字段,增强了查找表条目的表达能力,提高了查找表条目的聚合能力。从而减小了 查找表的规模,降低了片上存储需求,减小了芯片面积、成本、查表时间及功耗,提高了网络规模可扩展性。According to the technical solution provided by the embodiment, by adding an operation field to the lookup table entry, the expression capability of the lookup table entry is enhanced, and the aggregation capability of the lookup table entry is improved. Thereby reducing The size of the lookup table reduces the on-chip storage requirements, reduces chip area, cost, table lookup time and power consumption, and improves network scale scalability.
图5为依据本发明一实施例的查找表500结构示意图。如图5所示,查找表500包括匹配域502和动作域504。FIG. 5 is a schematic structural diagram of a lookup table 500 according to an embodiment of the invention. As shown in FIG. 5, lookup table 500 includes a match field 502 and an action field 504.
匹配域502包括但不限于网络标识和地址运算符。 Matching field 502 includes, but is not limited to, a network identity and address operator.
可选的,网络标识可以表示为一个n维标签A1.A2.….An,从左到右可以分别称为第1维,第2维,……,第n维。网络标识的每一维是一个数值,根据需要可以表示成二进制、十进制和十六进制等任意进制形式。Optionally, the network identifier may be represented as an n-dimensional label A1.A2.....An, which may be referred to as a first dimension, a second dimension, ..., an nth dimension from left to right. Each dimension of the network identifier is a numerical value, which can be expressed in any binary form such as binary, decimal, and hexadecimal as needed.
可选的,网络标识包括但不限于MAC地址、IP地址等。Optionally, the network identifier includes but is not limited to a MAC address, an IP address, and the like.
可选的,匹配域502还包括掩码,掩码是一个与网络标识相对应的n维标签,其维数和每一维数值的位数与网络标识相同。掩码与网络标识进行二进制“位与(&)”操作,以产生用于执行查找表匹配的地址,因此可以认为掩码中某一维数值的某一个二进制位为1,则网络标识中对应的二进制位有效。Optionally, the matching field 502 further includes a mask, where the mask is an n-dimensional label corresponding to the network identifier, and the dimension of the dimension and the value of each dimension is the same as the network identifier. The mask performs a binary "bit and (&)" operation with the network identifier to generate an address for performing a lookup table matching. Therefore, it can be considered that a certain bit of a certain dimension value in the mask is 1, and the network identifier corresponds to The binary bit is valid.
可选的,为了增强掩码操作后网络标识的表达能力,掩码字段同时支持连续和非连续掩码,例如255.0.255.0。Optionally, in order to enhance the expressive capability of the network identifier after the mask operation, the mask field supports both continuous and non-continuous masks, for example, 255.0.255.0.
可选的,地址运算符包括但不限于等于(==)、不等于(≠)、大于(>)、小于(<)、大于等于(≥)和小于等于(≤)等关系比较操作。OP用于执行比较操作“目的地址OP网络标识”或者“(目的地址&掩码)OP(网络标识&掩码)”,其中“&”表示位与操作。Optionally, the address operators include, but are not limited to, a relational comparison operation equal to (==), not equal to (≠), greater than (>), less than (<), greater than or equal to (≥), and less than or equal to (≤). The OP is used to perform a comparison operation "destination address OP network identification" or "(destination address & mask) OP (network identification & mask)", where "&" indicates a bit and an operation.
可选的,OP两边的比较项各自作为一个整体数值进行比较。Optionally, the comparison items on both sides of the OP are each compared as a whole value.
可选的,OP两边的比较项可以从第1维到第n维呈高字节到低字节顺序排列或从第1维到第n维呈低字节到高字节顺序排列。Optionally, the comparison items on both sides of the OP may be arranged from the first byte to the nth dimension in a high byte to a low byte order or from the first dimension to the nth dimension in a low byte to a high byte order.
可选的,OP两边的比较项还可以各自从n维标签中选择其中的m维标签作为一个整体数值进行比较,该m维标签从第1维到第m维呈高字节到低字节顺序排列或从第1维到第m维呈低字节到高字节顺序排列。Optionally, the comparison items on both sides of the OP may also respectively select an m-dimensional label from the n-dimensional label as an overall value, and the m-dimensional label is high byte to low byte from the first dimension to the m-th dimension. Arrange sequentially or from low byte to high byte order from the first dimension to the mth dimension.
例如,“210.10.10.0|255.0.255.0|≠”表示“第1维和第3维数值不等于210和10的地址的集合”,以此可以过滤某个地址子集;For example, "210.10.10.0|255.0.255.0|≠" means "the first and third dimension values are not equal to the set of addresses of 210 and 10", so that a certain subset of addresses can be filtered;
“11.12.13.14.15|0.0.0.255.0|==”表示“第4维的数值为14,以此可 以比较地址中某一维的数值;"11.12.13.14.15|0.0.0.255.0|==" means that the value of the fourth dimension is 14, which means To compare the value of a dimension in an address;
“11.12.13.14|255.255.255.255|>”表示地址值比11.12.13.14大的地址。假设目的地址为“11.12.14.10”,则执行的比较操作为“(11.12.14.10&255.255.255.255)>(11.12.13.14&255.255.255.255)”即“11.12.14.10>11.12.13.14”,结果为“真(True)”,以此可以比较两个地址的大小。"11.12.13.14|255.255.255.255|>" indicates an address with a larger address value than 11.12.13.14. Assuming the destination address is "11.12.14.10", the comparison operation performed is "(11.12.14.10&255.255.255.255)>(11.12.13.14&255.255.255.255)", that is, "11.12.14.10>11.12.13.14", The result is "True", which allows you to compare the size of two addresses.
可选的,匹配域502还包含优先级信息,优先级的作用是:当存在多个匹配条目时,选择优先级最高的匹配条目为最终匹配条目。优先级可以是一个数值,用以标识查找表条目的优先级高低,可以是数值越大优先级越高,也可以是数值越小优先级越高。优先级也可以是其他能够区别大小或顺序的表达方式,比如英文字符等。Optionally, the matching field 502 further includes priority information. When the multiple matching entries exist, the matching entry with the highest priority is selected as the final matching entry. The priority can be a value that identifies the priority of the lookup table entry. The greater the value, the higher the priority, or the smaller the value, the higher the priority. The priority can also be other expressions that can distinguish between size or order, such as English characters.
可选的,查找表500的所有条目是按照优先级从高到低进行排序的,当进行匹配的时候,按照优先级从高到低的顺序就行匹配。Optionally, all entries of the lookup table 500 are sorted according to priority from high to low. When matching is performed, the matching is performed in descending order of priority.
可选的,输出端口字段支持静态和动态两种输出端口表示。静态端口表示与传统查找表一致,用某一具体常数值表示端口号。动态端口表示基于算法实现,以此增强查找表条目中输出端口的表达能力。Optionally, the output port field supports both static and dynamic output port representations. The static port representation is consistent with the traditional lookup table, with a specific constant value representing the port number. The dynamic port representation is based on an algorithm implementation to enhance the expressive power of the output port in the lookup table entry.
动态输出端口的表达式包括但不限于以下操作:DimValue(addr,k),FirstDiffDim(addr1,addr2)或FirstDiffDimValue(addr1,addr2)等操作。Expressions for dynamic output ports include, but are not limited to, the following operations: DimValue(addr,k), FirstDiffDim(addr1, addr2), or FirstDiffDimValue(addr1, addr2).
其中,DimValue(addr,k):取地址addr中的第k维分量(下文缩写为“DV”);Where DimValue(addr,k): takes the kth dimension component in the address addr (hereinafter abbreviated as "DV");
FirstDiffDim(addr1,addr2):比较地址addr1和地址addr2两个地址,并返回第一个不同维度分量的维度号(下文缩写为“FDD”);FirstDiffDim (addr1, addr2): compares the addresses addr1 and address addr2, and returns the dimension number of the first different dimension component (hereinafter abbreviated as "FDD");
FirstDiffDimValue(addr1,addr2):比较地址addr1和地址addr2两个地址,确定第一个不同维度的维度号,并返回addr1在该维度的分量(下文缩写为“FDDV”)。FirstDiffDimValue(addr1, addr2): Compares the addresses addr1 and address addr2, determines the dimension number of the first different dimension, and returns the component of addr1 in this dimension (hereinafter abbreviated as "FDDV").
可选的,动态端口支持地址符号表示,地址符号包括但不限于:目的地址(dst),源地址(src),当前节点地址(hst),网络标识(net)等。addr、addr1和addr2均可以为目的地址(dst),源地址(src),当前节点地址(hst)或网络标识(net)中的任一一种。其中,dst为数据包中的目的地址,src为数据包中的源地址,hst为数据包当前所到达的节点(包括 网络设备)的地址,net是当前节点的查找表的当前处理的查找表条目中的网络标识字段的值。Optionally, the dynamic port supports address symbol representation, and the address symbol includes but is not limited to: destination address (dst), source address (src), current node address (hst), network identifier (net), and the like. Addr, addr1, and addr2 can each be a destination address (dst), a source address (src), a current node address (hst), or a network identifier (net). Where dst is the destination address in the data packet, src is the source address in the data packet, and hst is the node to which the data packet currently arrives (including The address of the network device, net is the value of the network identification field in the currently processed lookup table entry of the lookup table of the current node.
可选的,动态端口算法支持加、减、乘、除、移位等所有的数学运算符中的至少一种。Optionally, the dynamic port algorithm supports at least one of all mathematical operators such as addition, subtraction, multiplication, division, and shift.
例如,“DV(dst,2)”表示“取目的地址中第2维地址分量作为输出端口”。当dst为5.6.7.8.9时,其输出端口为6;For example, "DV(dst, 2)" means "the second-dimensional address component of the destination address is used as an output port". When dst is 5.6.7.8.9, its output port is 6;
“DV(dst,4)+4”表示“取目的地址中第4维地址分量值加4作为输出端口”。当dst为5.6.7.8.9时,输出端口为12。"DV(dst, 4)+4" means "the value of the 4th-order address component in the destination address plus 4 as an output port". When dst is 5.6.7.8.9, the output port is 12.
“FDD(dst,src)”表示“取目的和源地址中维度分量不同的第一个维度号作为输出端口”。当dst为1.5.7,src为1.6.4时,输出端口为2。"FDD(dst, src)" means "the first dimension number different from the dimension component in the destination and source addresses as the output port". When dst is 1.5.7 and src is 1.6.4, the output port is 2.
“FDDV(dst,src)”表示“取目的和源地址中第一个不同维度分量所在维度的目的地址分量作为输出端口”。当dst为1.5.7,src为1.6.4时,输出端口为5。"FDDV(dst, src)" means "the destination address component of the dimension of the first different dimension component in the destination and source address is taken as the output port". When dst is 1.5.7 and src is 1.6.4, the output port is 5.
可选的,输出端口包含N个端口,所述N个端口中的任意一个端口均能实现所述数据包的转发,其中N为大于0的自然数。Optionally, the output port includes N ports, and any one of the N ports can implement forwarding of the data packet, where N is a natural number greater than 0.
例如,“List(2,4,6)”表示“端口2、4和6”;“Range(6,10)”表示“端口6~10”。For example, "List(2,4,6)" means "ports 2, 4, and 6"; "Range(6,10)" means "ports 6 to 10".
可选的,如果输出端口支持N个可用端口,则网络设备根据哈希算法从所述N个端口中选择一个转发端口,用于数据包的转发。Optionally, if the output port supports N available ports, the network device selects one forwarding port from the N ports according to a hash algorithm, for forwarding the data packet.
可选的,动作域504还支持其他动作信息,用于对数据包进行操作。Optionally, the action field 504 also supports other action information for operating on the data packet.
根据本实施例公开的查找表结构,通过给查找表条目增加运算字段,增强了查找表条目的表达能力,提高了查找表条目的聚合能力。从而减小了查找表的规模,降低了片上存储需求,减小了芯片面积、成本、查表时间及功耗,提高了网络规模可扩展性。According to the lookup table structure disclosed in this embodiment, by adding an operation field to the lookup table entry, the expression capability of the lookup table entry is enhanced, and the aggregation capability of the lookup table entry is improved. Thereby reducing the size of the lookup table, reducing on-chip storage requirements, reducing chip area, cost, table lookup time and power consumption, and improving network scale scalability.
图6为依据本发明一实施例的查表路由方法应用场景600的系统逻辑结构示意图,如图6所示,所示网络是高性能计算机和数据中心中一种非常重要的网络——胖树,图中显示了使用本发明的方法,胖树网络执行基于目的地址路由(Dst-Routing)算法的查表路由实现和数据包从源节点1.0.0到目的节点3.1.1的路由转发过程。胖树Dst-Routing路由算法是一种向上/ 向下路由(Up-Down Routing),其路由规则是:当源主机节点向目的主机节点发送数据包时,数据包首先从源节点出发,一直向上路由和转发到源和目的主机交换节点的最近公共祖先交换节点(交换机或路由器),然后进入向下路由和转发阶段,一直向下路由和转发到目的主机节点。在向上和向下路由时,交换节点的输出端口号由目的主机节点的网络标识(目的地址)和交换节点所在层号确定。FIG. 6 is a schematic diagram of a system logical structure of a table lookup routing method application scenario 600 according to an embodiment of the present invention. As shown in FIG. 6, the network shown is a very important network in a high performance computer and a data center - a fat tree. The figure shows the use of the method of the present invention. The fat tree network performs a table lookup routing implementation based on a destination address routing (Dst-Routing) algorithm and a routing forwarding process of a data packet from a source node 1.0.0 to a destination node 3.1.1. The fat tree Dst-Routing routing algorithm is an up/ Up-Down Routing, the routing rule is: When the source host node sends a data packet to the destination host node, the data packet starts from the source node and is always routed up and forwarded to the nearest source and destination host switching node. The common ancestor switches nodes (switches or routers) and then enters the down-route and forwarding phase, routing and forwarding down to the destination host node. When routing up and down, the output port number of the switching node is determined by the network identifier (destination address) of the destination host node and the layer number of the switching node.
可选的,当胖树按照图6方式对交换机和主机节点编址,如果数据包的目的主机节点的目的地址为A1.A2.….An,数据包当前到达的交换节点所在层号为L,则向上路由时选择端口M/2+An-L作为输出端口号,向下路由时选择An-L作为输出端口号,其中n为胖树层数,M为交换节点端口数。Optionally, when the fat tree addresses the switch and the host node according to the manner of FIG. 6, if the destination address of the destination host node of the data packet is A1.A2.....An, the layer number of the switching node currently arriving by the data packet is L. Then, select port M/2+An-L as the output port number when routing upwards, and select An-L as the output port number when routing downwards, where n is the number of fat tree layers and M is the number of switching node ports.
在本实施例中,端节点(主机节点)地址表示为A1.A2.A3,交换节点地址表示为B1.B2.(L+M/2),其中M为交换节点的端口数。In this embodiment, the end node (host node) address is represented as A1.A2.A3, and the switching node address is represented as B1.B2.(L+M/2), where M is the number of ports of the switching node.
数据包要从源节点1.0.0发送到目的节点3.1.1,当采用目的地址路由算法时,基于目的地址路由经过交换节点1.0.2,1.1.3,1.1.4,3.1.3和3.1.2。根据本发明的路由方法进行数据包的路由转发时,交换节点1.0.2的查找表如表2所示,当数据包到达交换节点1.0.2时,交换节点1.0.2处的网络设备从数据包提取目的节点地址,其目的节点地址为3.1.1,按照“(目的地址&掩码)OP(网络标识&掩码)”的逻辑结果查找匹配条目,如果结果为“真”,则表示匹配。“(3.1.1&255.255.0)==(1.0.0&255.255.0)”的逻辑运算结果为“假”,表示不匹配;“(3.1.1&255.255.0)≠(1.0.0&255.255.0)”的逻辑运算结果为“真”,表示匹配。匹配条目的输出端口为动态输出端口,DV(dst,3)+2=DV(3.1.1,3)+2=3,根据动态端口算法和目的地址可知最终输出端口为端口3,交换节点1.0.2将数据包从端口3转发。与端口3相连的的下一跳交换节点是1.1.3,所以数据包从交换节点1.0.2的端口3发出后到达交换节点1.1.3。The data packet shall be sent from the source node 1.0.0 to the destination node 3.1.1. When the destination address routing algorithm is adopted, the destination address is routed through the switching nodes 1.0.2, 1.1.3, 1.1.4, 3.1.3 and 3.1. 2. When the routing method according to the present invention performs routing and forwarding of data packets, the lookup table of the switching node 1.0.2 is as shown in Table 2. When the data packet arrives at the switching node 1.0.2, the network device slave data at the switching node 1.0.2 The packet extracts the destination node address, whose destination node address is 3.1.1, and finds the matching entry according to the logical result of "(destination address & mask) OP (network identifier & mask)". If the result is "true", it means matching . The logical operation result of "(3.1.1&255.255.0)==(1.0.0&255.255.0)" is "false", indicating no match; the logic of "(3.1.1&255.255.0)≠(1.0.0&255.255.0)" The result of the operation is "true", indicating a match. The output port of the matching entry is the dynamic output port, DV(dst,3)+2=DV(3.1.1,3)+2=3. According to the dynamic port algorithm and destination address, the final output port is port 3, and the switching node is 1.0. .2 forward the packet from port 3. The next hop switching node connected to port 3 is 1.1.3, so the packet arrives at port 3 of switching node 1.0.2 and arrives at switching node 1.1.3.
表2Table 2
网络标识Network identification 掩码Mask 操作符Operator 输出端口Output port ...
1.0.01.0.0 255.255.0255.255.0 ==== DV(dst,3)DV (dst, 3) ...
1.0.01.0.0 255.255.0255.255.0 DV(dst,3)+2DV(dst,3)+2 ...
交换节点1.1.3的查找表如表3所示,“(3.1.1&255.0.0)==(1.0.0&255.0.0)”的逻辑运算结果为“假”,表示不匹配;“((3.1.1&255.0.0)≠(1.0.0&255.0.0)”的逻辑运算结果为“真”,表示匹配。匹配条目的输出端口为动态输出端口,DV(dst,2)+2=DV(3.1.1,2)+2=3,根据动态端口算法和目的地址可知最终输出端口为端口3,交换节点1.3.1将数据包从端口3转发。与端口3相连的的下一跳交换节点是1.1.4,所以数据包从交换节点1.1.3的端口3发出后到达交换节点1.1.4。The lookup table of the switching node 1.1.3 is shown in Table 3. The logical operation result of "(3.1.1&255.0.0)==(1.0.0&255.0.0)" is "false", indicating no match; "(3.1. The logical operation result of 1&255.0.0)≠(1.0.0&255.0.0)” is “true”, indicating a match. The output port of the matching entry is the dynamic output port, DV(dst, 2)+2=DV(3.1.1, 2) +2=3, according to the dynamic port algorithm and destination address, the final output port is port 3, and the switching node 1.3.1 forwards the packet from port 3. The next hop switching node connected to port 3 is 1.1.4. , so the packet is sent from port 3 of the switching node 1.1.3 to the switching node 1.1.4.
表3table 3
网络标识Network identification 掩码Mask 操作符Operator 输出端口Output port ...
1.0.01.0.0 255.0.0255.0.0 ==== DV(dst,2)DV (dst, 2) ...
1.0.01.0.0 255.0.0255.0.0 DV(dst,2)+2DV(dst,2)+2 ...
交换节点1.1.4的查找表如表4所示,“(3.1.1&0.0.0)==(0.0.0&0.0.0)”的逻辑运算结果为“真”,表示匹配。匹配条目的输出端口为动态输出端口,DV(dst,1)=DV(3.1.1,1)=3,根据动态端口算法和目的地址可知最终输出端口为端口3,交换节点1.1.4将数据包从端口3转发,与端口3相连的的下一跳交换节点是3.1.3,所以交换节点1.1.4将数据包从端口3转发给交换节点3.1.3。The lookup table of the switching node 1.1.4 is shown in Table 4. The logical operation result of "(3.1.1&0.0.0)==(0.0.0&0.0.0)" is "true", indicating a match. The output port of the matching entry is the dynamic output port, DV(dst, 1)=DV(3.1.1,1)=3. According to the dynamic port algorithm and destination address, the final output port is port 3, and the switching node 1.1.4 will be the data. The packet is forwarded from port 3, and the next hop switching node connected to port 3 is 3.1.3, so switching node 1.1.4 forwards the packet from port 3 to switching node 3.1.3.
表4Table 4
网络标识Network identification 掩码Mask 操作符Operator 输出端口Output port ...
0.0.00.0.0 0.0.00.0.0 ==== DV(dst,1)DV(dst,1) ...
交换节点3.1.3的查找表如表5所示,“(3.1.1&255.0.0)==(3.0.0&255.0.0)”的逻辑运算结果为“真”,表示匹配;“((3.1.1&255.0.0)≠(3.0.0&255.0.0)”的逻辑运算结果为“假”,表示不匹配。匹配条目的输出端口为动态输出端口,DV(dst,2)=DV(3.1.1,2)=1,根据动态端口算法和目的地址可知最终输出端口为端口1,交换节点3.1.3将数据包从端口1转发,与端口1的相连的下一跳交换节点是3.1.2,所以交换节点3.1.3将数据包从端口1转发给交换节点3.1.2。The lookup table of the switching node 3.1.3 is as shown in Table 5. The logical operation result of "(3.1.1&255.0.0)==(3.0.0&255.0.0)" is "true", indicating a match; "((3.1.1&255) The logical operation result of .0.0)≠(3.0.0&255.0.0)” is “false”, indicating no match. The output port of the matching entry is the dynamic output port, DV(dst, 2)=DV(3.1.1, 2) =1, according to the dynamic port algorithm and the destination address, the final output port is port 1, the switching node 3.1.3 forwards the data packet from port 1, and the next hop switching node connected to port 1 is 3.1.2, so the switching node 3.1.3 Forward the packet from port 1 to the switching node 3.1.2.
表5table 5
网络标识Network identification 掩码Mask 操作符Operator 输出端口Output port ...
3.0.03.0.0 255.0.0255.0.0 ==== DV(dst,2)DV (dst, 2) ...
3.0.03.0.0 255.0.0255.0.0 DV(dst,2)+2DV(dst,2)+2 ...
交换节点3.1.2的查找表如表6所示,“(3.1.1&255.255.0)== (3.1.0&255.255.0)”的逻辑运算结果为“真”,表示匹配;“((3.1.1&255.255.0)≠(3.1.0&255.255.0)”的逻辑运算结果为“假”,表示不匹配。匹配条目的输出端口为动态输出端口,DV(dst,3)=DV(3.1.1,3)=1,根据动态端口算法和目的地址可知最终输出端口为端口1,交换节点3.1.2将数据包从端口1转发,与端口1相连的的下一跳节点为目的节点3.1.1,所以交换节点1.3.1将数据包从端口1转发给目的节点3.1.1,从而完成数据包从源节点1.0.0到目的节点3.1.1的路由和转发。The lookup table of the switching node 3.1.2 is shown in Table 6, "(3.1.1 & 255.255.0) == The logical operation result of (3.1.0&255.255.0)" is "true", indicating a match; "(3.1.1&255.255.0)≠(3.1.0&255.255.0)") has a logical operation result of "false", indicating that it does not match. The output port of the matching entry is a dynamic output port, DV(dst, 3)=DV(3.1.1, 3)=1. According to the dynamic port algorithm and destination address, the final output port is port 1, and the switching node 3.1.2 will The data packet is forwarded from port 1, and the next hop node connected to port 1 is the destination node 3.1.1, so the switching node 1.3.1 forwards the data packet from port 1 to the destination node 3.1.1, thereby completing the packet from the source. Routing and forwarding from node 1.0.0 to destination node 3.1.1.
表6Table 6
网络标识Network identification 掩码Mask 操作符Operator 输出端口Output port ...
3.1.03.1.0 255.255.0255.255.0 ==== DV(dst,3)DV (dst, 3) ...
3.1.03.1.0 255.255.0255.255.0 DV(dst,3)+2DV(dst,3)+2 ...
当胖树的层数为n,目的地址(dst)为D1.D2.D3..Dn-L..Dn-1.Dn,交换机节点端口数为M,当前交换节点所在层号为L,当前交换节点地址为C1.C2.….Cn-1.(L+M/2)时,按照Dst-Routing路由算法,胖树顶层交换节点的查找表可表示为表7所示的一般形式,非顶层交换节点查找表可表示为表8所示的一般形式。为了便于表示,此处掩码字段用二进制表示。When the number of layers of the fat tree is n, the destination address (dst) is D1.D2.D3..Dn-L..Dn-1.Dn, the number of ports of the switch node is M, and the layer number of the current switching node is L, currently When the switching node address is C1.C2.....Cn-1.(L+M/2), according to the Dst-Routing routing algorithm, the lookup table of the fat tree top-level switching node can be expressed as the general form shown in Table 7, non- The top-level switching node lookup table can be represented in the general form shown in Table 8. For ease of representation, the mask field is represented here in binary.
表7Table 7
网络标识Network identification 掩码Mask 操作符Operator 输出端口Output port ...
A1.A2.….An-L-1.0.….0A 1 .A 2 .....A nL-1 .0.....0 11…1.11…1.….11…1.00…0.….00…011...1.11...1.....11...1.00...0.....00...0 ==== DV(dst,n-L)DV (dst, n-L) ...
表8Table 8
网络标识Network identification 掩码Mask 操作符Operator 输出端口Output port ...
A1.A2.….An-L-1.0.….0A 1 .A 2 .....A nL-1 .0.....0 11…1.11…1.….11…1.0.0…0.….00…011...1.11...1.....11...1.0.0...0.....00...0 ==== DV(dst,n-L)DV (dst, n-L) ...
A1.A2.….An-L-1.0.….0A 1 .A 2 .....A nL-1 .0.....0 11…1.11…1.….11…1.00…0.….00…011...1.11...1.....11...1.00...0.....00...0 DV(dst,n-L)+M/2DV(dst,n-L)+M/2 ...
根据本实施例公开的路由方法,通过给查找表条目增加运算字段,增强了查找表条目的表达能力,从而提高了查找表条目的聚合能力。减小了查找表的规模,降低了对片上存储空间的需求,从而减小了芯片面积、成本、查表时间及功耗,提高了网络规模可扩展性。According to the routing method disclosed in this embodiment, by adding an operation field to the lookup table entry, the expression capability of the lookup table entry is enhanced, thereby improving the aggregation capability of the lookup table entry. The size of the lookup table is reduced, the requirement for on-chip storage space is reduced, thereby reducing chip area, cost, table lookup time and power consumption, and improving network scale scalability.
图7为依据本发明一实施例的路由方法应用场景700的系统逻辑结构示意图,如图7所示,以二维网格(mesh)网络的XY路由算法为例,说明本发明的应用场景。Mesh网络是一种规则的直接网络,每个节点既是计算节点也是交换节点。在n维mesh网络中,在每一维上每个节点仅和它相 邻的(两个)节点相连。Mesh网络具有连线短,易于封装,局部性好,能够增量扩展等优点,因此被广泛使用。FIG. 7 is a schematic diagram of a system logical structure of a routing method application scenario 700 according to an embodiment of the present invention. As shown in FIG. 7, an XY routing algorithm of a two-dimensional mesh network is taken as an example to illustrate an application scenario of the present invention. A mesh network is a direct network of rules. Each node is both a compute node and a switch node. In an n-dimensional mesh network, each node is only associated with it in each dimension. Neighboring (two) nodes are connected. Mesh networks are widely used because of their short connection, easy packaging, good locality, and incremental expansion.
如图7所示,以节点2.2为例,依据本发明,其查找表如表9所示,As shown in FIG. 7, taking node 2.2 as an example, according to the present invention, the lookup table is as shown in Table 9.
表9Table 9
网络标识Network identification 掩码Mask 操作符Operator 优先级priority 输出端口Output port ...
2.02.0 255.0255.0 < 1010 00 ...
2.02.0 255.0255.0 > 1010 22 ...
0.20.2 0.2550.255 < 2020 11 ...
0.20.2 0.2550.255 > 2020 33 ...
基于本实施例公开的路由方法,对于由任意端口数的节点和任意维数构建的Mesh网络,任何节点的查找表所需条目数不多于该节点的端口数。Based on the routing method disclosed in this embodiment, for a mesh network constructed by any number of nodes and an arbitrary number of dimensions, the number of entries required for the lookup table of any node is not more than the number of ports of the node.
图8为依据本发明一实施例的路由方法应用场景800的系统逻辑结构示意图,如图8所示,以BCube网络为例,说明本发明路由方法的应用场景。BCube是一种利于大规模网络的模块化解决方案,利用超立方体的节点连接关系作为递归规律,同层次不同递归单元中相同位置上的所有服务器都通过一个交换机相互连接。该结构要求每个服务器都装有多个端口,具备超立方体连通性高、直径小、可靠性高的优点。FIG. 8 is a schematic diagram of a system logical structure of a routing method application scenario 800 according to an embodiment of the present invention. As shown in FIG. 8 , a BCube network is taken as an example to illustrate an application scenario of the routing method of the present invention. BCube is a modular solution for large-scale networks. It uses the hyper-cube node connection relationship as a recursive rule. All servers in the same position in different recursive units in the same layer are connected to each other through a switch. This structure requires multiple ports per server, and has the advantages of high hypercube connectivity, small diameter, and high reliability.
数据包从源节点1.2传送到目的节点3.3时,依次经过节点2.5,3.2和3.4,根据本发明的路由方法进行数据包的转发时,源节点1.2的查找表如表10所示,数据包目的节点地址为3.3,按照“(目的地址&掩码)OP(网络标识&掩码)”的逻辑结果查找匹配条目,如果结果为“真”,则表示匹配。表10仅有一个条目,且“(目的地址&0.0)==(网络标识&00)”的逻辑运算结果恒为“真”,表示匹配。匹配条目的输出端口为动态输出端口,2-FDD(dst,hst)=2-FDD(3.3,1.2)=1,根据动态端口算法和目的地址可知最终输出端口为端口1,源节点1.2将数据包从端口1发出,与端口1相连的下一跳交换节点是2.5,源节点1.2将数据包从端口1转发给交换节点2.5。When the data packet is transmitted from the source node 1.2 to the destination node 3.3, and sequentially passes through the nodes 2.5, 3.2, and 3.4, and the data packet is forwarded according to the routing method of the present invention, the lookup table of the source node 1.2 is as shown in Table 10, and the purpose of the data packet is The node address is 3.3, and the matching entry is found according to the logical result of "(destination address & mask) OP (network identifier & mask)". If the result is "true", it means matching. Table 10 has only one entry, and the logical operation result of "(destination address &0.0) == (network identifier & 00)" is always "true", indicating a match. The output port of the matching entry is a dynamic output port, 2-FDD(dst, hst)=2-FDD(3.3,1.2)=1. According to the dynamic port algorithm and destination address, the final output port is port 1, and the source node 1.2 will data. The packet is sent from port 1, and the next hop switching node connected to port 1 is 2.5, and the source node 1.2 forwards the packet from port 1 to switching node 2.5.
表10Table 10
网络标识Network identification 掩码Mask 操作符Operator 输出端口Output port ...
0.00.0 0.00.0 ==== 2-FDD(dst,hst)2-FDD(dst,hst) ...
交换节点2.5的查找表如表11所示,表11仅有一个条目,且“(目 的地址&0.0)==(网络标识&0.0)”的逻辑运算结果恒为“真”,表示匹配。匹配条目的输出端口为动态输出端口,DV(dst,1)=DV(3.3,1)=3,根据动态端口算法和目的地址可知最终输出端口为端口3,交换节点2.5将数据包从端口3发出,与端口3相连的下一跳节点是3.2,交换节点2.5将数据包从端口3转发给节点3.2。The lookup table of the switching node 2.5 is shown in Table 11, and Table 11 has only one entry, and "( The logical operation result of the address &0.0)==(network identifier &0.0)" is always "true", indicating a match. The output port of the matching entry is a dynamic output port, and DV(dst, 1)=DV(3.3, 1) = 3, according to the dynamic port algorithm and destination address, the final output port is port 3, the switching node 2.5 sends the data packet from port 3, the next hop node connected to port 3 is 3.2, and the switching node 2.5 sends the data packet from Port 3 is forwarded to node 3.2.
表11Table 11
网络标识Network identification 掩码Mask 操作符Operator 输出端口Output port ...
0.00.0 0.00.0 ==== DV(dst,1)DV(dst,1) ...
节点3.2的查找表如表12所示,表12仅有一个条目,且“(目的地址&0.0)==(网络标识&00)”的逻辑运算结果恒为“真”,表示匹配。匹配条目的输出端口为动态输出端口,2-FDD(dst,hst)=2-FDD(3.3,3.2)=0,根据动态端口算法和目的地址可知最终输出端口为端口0,节点3.2将数据包从端口0转发,与端口0相连的下一跳交换节点是3.4,节点3.2将数据包从端口0转发给交换节点3.4。The lookup table of node 3.2 is shown in Table 12. Table 12 has only one entry, and the logical operation result of "(destination address &0.0) == (network identifier & 00)" is always "true", indicating a match. The output port of the matching entry is a dynamic output port, 2-FDD(dst, hst)=2-FDD(3.3,3.2)=0. According to the dynamic port algorithm and destination address, the final output port is port 0, and node 3.2 will be the data packet. Forwarded from port 0, the next hop switching node connected to port 0 is 3.4, and node 3.2 forwards the data packet from port 0 to switching node 3.4.
表12Table 12
网络标识Network identification 掩码Mask 操作符Operator 输出端口Output port ...
0.00.0 0.00.0 ==== 2-FDD(dst,hst)2-FDD(dst,hst) ...
交换节点3.4的查找表如表13所示,表13仅有一个条目,且“(目的地址&0.0)==(网络标识&00)”的逻辑运算结果恒为“真”,表示匹配。匹配条目的输出端口为动态输出端口,DV(dst,2)=DV(3.3,2)=3,根据动态端口算法和目的地址可知最终输出端口为端口3,交换节点3.4将数据包从端口3发出。与端口3相连的下一跳节点为目的节点3.3,所以交换节点3.4将数据包从端口3转发给目的节点3.3。The lookup table of the switching node 3.4 is as shown in Table 13. Table 13 has only one entry, and the logical operation result of "(destination address &0.0) == (network identifier & 00)" is always "true", indicating a match. The output port of the matching entry is a dynamic output port, and DV(dst, 2)=DV(3.3, 2)=3. According to the dynamic port algorithm and the destination address, the final output port is port 3, and the switching node 3.4 sends the packet from port 3. issue. The next hop node connected to port 3 is the destination node 3.3, so the switching node 3.4 forwards the data packet from port 3 to the destination node 3.3.
表13Table 13
网络标识Network identification 掩码Mask 操作符Operator 输出端口Output port ...
0.00.0 0.00.0 ==== DV(dst,2)DV (dst, 2) ...
根据本实施例公开的路由方法,通过给查找表条目增加运算字段,增强了查找表条目的表达能力,从而提高了查找表条目的聚合能力,对于由任意端口数的交换节点和任意网络层数构建的BCube网络,任何节点的查找表都仅需1个查找表条目。可以大幅度地降低对片上存储空间的需求, 从而减小了芯片面积、成本、查表时间及功耗,提高网络可扩展性。According to the routing method disclosed in this embodiment, by adding an operation field to the lookup table entry, the expression capability of the lookup table entry is enhanced, thereby improving the aggregation capability of the lookup table entry, and the number of switching nodes and arbitrary network layers for any number of ports. For a BCube network built, only one lookup table entry is required for any node lookup table. Can greatly reduce the need for on-chip storage space, Thereby reducing chip area, cost, table lookup time and power consumption, and improving network scalability.
图9是依据本发明一实施例的路由设备900的逻辑结构示意图,如图9所示,路由设备900至少包括:接收单元902,匹配单元904,发送单元906。FIG. 9 is a schematic diagram of a logical structure of a routing device 900 according to an embodiment of the present invention. As shown in FIG. 9, the routing device 900 includes at least a receiving unit 902, a matching unit 904, and a sending unit 906.
接收单元902,用于接收数据包,所述数据包中携带所述数据包的目的地址;The receiving unit 902 is configured to receive a data packet, where the data packet carries a destination address of the data packet;
匹配单元904,用于在路由表中确定与所述目的地址对应的匹配条目,其中,所述路由表的条目中包含地址运算符和网络标识,所述匹配条目的网络标识的有效位与所述目的地址的有效位按照所述匹配条目的地址运算符进行运算的逻辑运算结果为真;The matching unit 904 is configured to determine, in the routing table, a matching entry corresponding to the destination address, where the entry of the routing table includes an address operator and a network identifier, where the valid identifier of the network identifier of the matching entry The logical operation result of the valid bit of the destination address being operated according to the address operator of the matching entry is true;
发送单元906,用于从根据所述匹配条目中输出端口信息确定的输出端口发送所述数据包。The sending unit 906 is configured to send the data packet from an output port determined according to the output port information in the matching entry.
可选的,地址运算符两边的比较项各自作为一个整体数值进行比较。Optionally, the comparison terms on both sides of the address operator are each compared as an integer value.
可选的,地址运算符两边的比较项可以从第1维到第n维呈高字节到低字节顺序排列或从第1维到第n维呈低字节到高字节顺序排列。Optionally, the comparison items on both sides of the address operator may be arranged from the first byte to the nth dimension in a high byte to a low byte order or from the first dimension to the nth dimension in a low byte to a high byte order.
可选的,地址运算符两边的比较项还可以各自从n维标签中选择其中的m维标签作为一个整体数值进行比较,该m维标签从第1维到第m维呈高字节到低字节顺序排列或从第1维到第m维呈低字节到高字节顺序排列。Optionally, the comparison items on both sides of the address operator may each select an m-dimensional label from the n-dimensional label as an overall value, and the m-dimensional label is high byte to low from the first dimension to the mth dimension. The byte order is arranged or from the 1st dimension to the mth dimension in descending order of high byte order.
可选的,所述网络标识的有效位为将所述网络标识当做的一个整体数值,所述目的地址的有效位是指将所述目的地址当做的一个整体数值。Optionally, the valid bit of the network identifier is an overall value that is used to treat the network identifier, and the valid bit of the destination address refers to an overall value that is used as the destination address.
可选的,所述路由表的条目中还包括掩码,所述目的地址的有效位为所述目的地址与所述掩码位与操作的结果当做的一个整体数值,所述网络标识的有效位为所述网络标识与所述掩码位与操作的结果当做的一个整体数值。Optionally, the entry of the routing table further includes a mask, where a valid bit of the destination address is an overall value of the destination address and the mask bit and the result of the operation, and the network identifier is valid. The bit is an overall value of the network identification and the result of the mask bit and operation.
可选的,为了增强掩码操作后网络标识的表达能力,掩码字段同时支持连续和非连续掩码,例如255.0.255.0。Optionally, in order to enhance the expressive capability of the network identifier after the mask operation, the mask field supports both continuous and non-continuous masks, for example, 255.0.255.0.
可选的,所述路由表的条目中还包括优先级信息,所述优先级信息用于指示所属条目的优先级; Optionally, the entry of the routing table further includes priority information, where the priority information is used to indicate a priority of the belonging entry;
所述匹配单元904用于在路由表中确定与所述目的地址对应的匹配条目,包括:所述匹配单元904在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,并根据所述查找到的条目的优先级信息,从所述查找到的条目中,选择优先级最高的条目,作为所述匹配条目。The matching unit 904 is configured to determine, in the routing table, a matching entry corresponding to the destination address, where the matching unit 904 searches the routing table for the valid bit of the network identifier of the entry and the valid bit of the destination address. The logical operation result of the operation performed by the address operator of the entry is a true entry, and according to the priority information of the found entry, the entry with the highest priority is selected from the searched entry as the match. entry.
可选的,优先级可以是一个数值,用以标识查找表条目的优先级高低,可以是数值越大优先级越高,也可以是数值越小优先级越高。优先级也可以是其他能够区别大小或顺序的表达方式,比如英文字符等。Optionally, the priority may be a value to identify the priority of the lookup table entry. The greater the value, the higher the priority, or the smaller the value, the higher the priority. The priority can also be other expressions that can distinguish between size or order, such as English characters.
可选的,所述匹配单元904用于在路由表中确定与所述目的地址对应的匹配条目,包括:所述匹配单元904按照优先级从高到低的顺序在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,将所述找到的第一个条目作为所述匹配条目,其中,所述查找表的条目按照优先级进行排序。Optionally, the matching unit 904 is configured to determine, in the routing table, a matching entry corresponding to the destination address, where the matching unit 904 searches for a network of entries in a routing table according to a priority from highest to lowest priority. An entry of a valid bit of the identifier and a valid bit of the destination address in accordance with an address operator of the entry is a true entry, and the first entry found is the match entry, wherein the lookup The entries for the table are sorted by priority.
可选的,所述发送单元906用于从根据所述匹配条目中的输出端口信息确定的输出端口发送所述数据包包括:所述发送单元906根据地址信息按照所述匹配条目中输出端口信息进行运算的结果,确定所述输出端口,并将所述数据包从所述输出端口进行发送,所述地址信息包括以下至少一种:所述目的地址、所述数据包的源地址、所述匹配条目的网络标识和当前节点地址。Optionally, the sending, by the sending unit 906, the sending, by using the output port determined according to the output port information in the matching entry, the sending, by the sending unit 906, according to the address information, outputting the port information according to the matching entry. As a result of the operation, determining the output port, and transmitting the data packet from the output port, the address information includes at least one of the following: the destination address, a source address of the data packet, and the Match the network ID of the entry and the current node address.
可选的,输出端口算法支持加、减、乘、除、移位等所有的数学运算符中的至少一种。Optionally, the output port algorithm supports at least one of all mathematical operators such as addition, subtraction, multiplication, division, and shift.
可选的,所述发送单元906用于从根据所述匹配条目中的输出端口信息确定的输出端口发送所述数据包包括:所述发送单元906根据哈希算法从所述输出端口信息中记录的多个端口中选择一个端口作为所述输出端口,并将所述数据包从所述输出端口进行转发。Optionally, the sending, by the sending unit 906, the sending, by the sending unit, the data packet, according to the output port information in the matching entry, includes: the sending unit 906 records from the output port information according to a hash algorithm. One of the plurality of ports is selected as the output port, and the data packet is forwarded from the output port.
可选的,所述设备还包括操作单元,所述匹配条目还包含操作信息,所述操作信息用于指示对所述数据包进行操作,所述操作单元用于根据所述匹配条目中的操作信息,对所述数据包进行操作。Optionally, the device further includes an operation unit, the matching entry further includes operation information, the operation information is used to indicate operation on the data packet, and the operation unit is configured to perform operations according to the matching item. Information, operating on the data packet.
可选的,该地址运算符包括但不限于等于(==)、不等于(≠)、大于(>)、小于(<)、大于等于(≥)和小于等于(≤)等关系比较操作。 Optionally, the address operator includes, but is not limited to, a relational comparison operation equal to (==), not equal to (≠), greater than (>), less than (<), greater than or equal to (≥), and less than or equal to (≤).
图10是依据本发明一实施例的路由设备1000的逻辑结构示意图,如图10所示,路由设备1000至少包括:接收单元1002,匹配单元1004,发送单元1006。FIG. 10 is a schematic diagram of a logical structure of a routing device 1000 according to an embodiment of the present invention. As shown in FIG. 10, the routing device 1000 includes at least a receiving unit 1002, a matching unit 1004, and a sending unit 1006.
接收单元1002,用于接收数据包,所述数据包中携带所述数据包的目的地址;The receiving unit 1002 is configured to receive a data packet, where the data packet carries a destination address of the data packet;
匹配单元1004,用于在路由表中确定与所述目的地址对应的匹配条目;The matching unit 1004 is configured to determine, in the routing table, a matching entry corresponding to the destination address;
发送单元1006,用于根据地址信息按照所述匹配条目中输出端口信息进行运算的结果,确定所述输出端口,并将所述数据包从所述输出端口进行发送,所述地址信息包括以下至少一种:所述目的地址、所述数据包的源地址、所述匹配条目的网络标识和当前节点地址。The sending unit 1006 is configured to determine, according to the result that the address information is operated according to the output port information in the matching entry, the output port, and send the data packet from the output port, where the address information includes at least the following A: the destination address, a source address of the data packet, a network identifier of the matching entry, and a current node address.
可选的,输出端口算法支持加、减、乘、除、移位等所有的数学运算符中的至少一种。Optionally, the output port algorithm supports at least one of all mathematical operators such as addition, subtraction, multiplication, division, and shift.
可选的,所述路由表的条目中包含地址运算符和网络标识,所述匹配条目的网络标识的有效位与所述目的地址的有效位按照所述匹配条目的地址运算符进行运算的逻辑运算结果为真。Optionally, the entry of the routing table includes an address operator and a network identifier, and the logic of the valid bit of the network identifier of the matching entry and the valid bit of the destination address are operated according to the address operator of the matching entry. The result of the operation is true.
可选的,地址运算符两边的比较项各自作为一个整体数值进行比较。Optionally, the comparison terms on both sides of the address operator are each compared as an integer value.
可选的,地址运算符两边的比较项可以从第1维到第n维呈高字节到低字节顺序排列或从第1维到第n维呈低字节到高字节顺序排列。Optionally, the comparison items on both sides of the address operator may be arranged from the first byte to the nth dimension in a high byte to a low byte order or from the first dimension to the nth dimension in a low byte to a high byte order.
可选的,地址运算符两边的比较项还可以各自从n维标签中选择其中的m维标签作为一个整体数值进行比较,该m维标签从第1维到第m维呈高字节到低字节顺序排列或从第1维到第m维呈低字节到高字节顺序排列。Optionally, the comparison items on both sides of the address operator may each select an m-dimensional label from the n-dimensional label as an overall value, and the m-dimensional label is high byte to low from the first dimension to the mth dimension. The byte order is arranged or from the 1st dimension to the mth dimension in descending order of high byte order.
可选的,所述网络标识的有效位为将所述网络标识当做的一个整体数值,所述目的地址的有效位是指将所述目的地址当做的一个整体数值。Optionally, the valid bit of the network identifier is an overall value that is used to treat the network identifier, and the valid bit of the destination address refers to an overall value that is used as the destination address.
可选的,所述路由表的条目中还包括掩码,所述目的地址的有效位为所述目的地址与所述掩码位与操作的结果当做的一个整体数值,所述网络标识的有效位为所述网络标识与所述掩码位与操作的结果当做的一个整体数值。 Optionally, the entry of the routing table further includes a mask, where a valid bit of the destination address is an overall value of the destination address and the mask bit and the result of the operation, and the network identifier is valid. The bit is an overall value of the network identification and the result of the mask bit and operation.
可选的,所述掩码包括连续掩码和非连续掩码。Optionally, the mask includes a continuous mask and a non-continuous mask.
可选的,所述路由表的条目中还包括优先级信息,所述优先级信息用于指示所属条目的优先级;Optionally, the entry of the routing table further includes priority information, where the priority information is used to indicate a priority of the belonging entry;
所述匹配单元1004用于在路由表中确定与所述目的地址对应的匹配条目,包括:所述匹配单元1004在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,并根据所述查找到的条目的优先级信息,从所述查找到的条目中,选择优先级最高的条目,作为所述匹配条目。The matching unit 1004 is configured to determine, in the routing table, a matching entry corresponding to the destination address, where the matching unit 1004 searches for a valid bit of the network identifier of the entry in the routing table and a valid bit of the destination address. The logical operation result of the operation performed by the address operator of the entry is a true entry, and according to the priority information of the found entry, the entry with the highest priority is selected from the searched entry as the match. entry.
可选的,优先级可以是一个数值,用以标识查找表条目的优先级高低,可以是数值越大优先级越高,也可以是数值越小优先级越高。优先级也可以是其他能够区别大小或顺序的表达方式,比如英文字符等。Optionally, the priority may be a value to identify the priority of the lookup table entry. The greater the value, the higher the priority, or the smaller the value, the higher the priority. The priority can also be other expressions that can distinguish between size or order, such as English characters.
可选的,所述匹配单元1004用于在路由表中确定与所述目的地址对应的匹配条目,包括:所述匹配单元1004按照优先级从高到低的顺序在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,将所述找到的第一个条目作为所述匹配条目,其中,所述查找表的条目按照优先级进行排序。Optionally, the matching unit 1004 is configured to determine, in the routing table, a matching entry corresponding to the destination address, where the matching unit 1004 searches for a network of entries in a routing table according to a priority from highest to lowest priority. An entry of a valid bit of the identifier and a valid bit of the destination address in accordance with an address operator of the entry is a true entry, and the first entry found is the match entry, wherein the lookup The entries for the table are sorted by priority.
可选的,所述设备还包括操作单元,所述匹配条目还包含操作信息,所述操作信息用于指示对所述数据包进行操作,所述操作单元用于根据所述匹配条目中的操作信息,对所述数据包进行操作。Optionally, the device further includes an operation unit, the matching entry further includes operation information, the operation information is used to indicate operation on the data packet, and the operation unit is configured to perform operations according to the matching item. Information, operating on the data packet.
可选的,该地址运算符包括但不限于等于(==)、不等于(≠)、大于(>)、小于(<)、大于等于(≥)和小于等于(≤)等关系比较操作。Optionally, the address operator includes, but is not limited to, a relational comparison operation equal to (==), not equal to (≠), greater than (>), less than (<), greater than or equal to (≥), and less than or equal to (≤).
可选的,网络标识包括但不限于MAC地址、IP地址等。Optionally, the network identifier includes but is not limited to a MAC address, an IP address, and the like.
图11是依据本发明一实施例的计算设备设备1100的硬件结构示意图。如图11所示,计算设备1100包括处理器1102、存储器1104、输入/输出接口1106、通信接口1108和总线1110。其中,处理器1102、存储器1104、输入/输出接口1106和通信接口1108通过总线1110实现彼此之间的通信连接。FIG. 11 is a schematic diagram showing the hardware structure of a computing device device 1100 according to an embodiment of the invention. As shown in FIG. 11, computing device 1100 includes a processor 1102, a memory 1104, an input/output interface 1106, a communication interface 1108, and a bus 1110. The processor 1102, the memory 1104, the input/output interface 1106, and the communication interface 1108 implement a communication connection with each other through the bus 1110.
处理器1102可以采用通用的中央处理器(Central Processing Unit,CPU),微处理器,应用专用集成电路(Application Specific Integrated  Circuit,ASIC),或者一个或多个集成电路,用于执行相关程序,以实现本发明实施例所提供的技术方案。The processor 1102 can be a general-purpose central processing unit (CPU), a microprocessor, and an application-specific integrated circuit (Application Specific Integrated). Circuit, ASIC), or one or more integrated circuits, for performing related procedures to implement the technical solutions provided by the embodiments of the present invention.
存储器1104可以是只读存储器(Read Only Memory,ROM),静态存储设备,动态存储设备或者随机存取存储器(Random Access Memory,RAM)。存储器1104可以存储操作系统和其他应用程序。在通过软件或者固件来实现本发明实施例提供的技术方案时,用于实现本发明实施例提供的技术方案的程序代码保存在存储器1104中,并由处理器1102来执行。The memory 1104 may be a read only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1104 can store an operating system and other applications. When the technical solution provided by the embodiment of the present invention is implemented by software or firmware, the program code for implementing the technical solution provided by the embodiment of the present invention is stored in the memory 1104 and executed by the processor 1102.
输入/输出接口1106用于接收输入的数据和信息,输出操作结果等数据。The input/output interface 1106 is for receiving input data and information, and outputting data such as operation results.
通信接口1108使用例如但不限于收发器一类的收发装置,来实现计算设备1100与其他设备或通信网络之间的通信。 Communication interface 1108 enables communication between computing device 1100 and other devices or communication networks using transceivers such as, but not limited to, transceivers.
总线1110可包括一通路,在计算设备1100各个部件(例如处理器1102、存储器1104、输入/输出接口1106和通信接口1108)之间传送信息。Bus 1110 can include a path for communicating information between various components of computing device 1100, such as processor 1102, memory 1104, input/output interface 1106, and communication interface 1108.
应注意,尽管图11所示的计计算设备1100仅仅示出了处理器1102、存储器1104、输入/输出接口1106、通信接口1108以及总线1110,但是在具体实现过程中,本领域的技术人员应当明白,计算设备1100还包含实现正常运行所必须的其他器件。同时,根据具体需要,本领域的技术人员应当明白,计算设备1100还可包含实现其他附加功能的硬件器件。此外,本领域的技术人员应当明白,计算设备1100也可仅仅包含实现本发明实施例所必须的器件,而不必包含图11中所示的全部器件。It should be noted that although the computing device 1100 shown in FIG. 11 only shows the processor 1102, the memory 1104, the input/output interface 1106, the communication interface 1108, and the bus 1110, in a specific implementation process, those skilled in the art should It is understood that computing device 1100 also includes other devices necessary to achieve proper operation. Also, those skilled in the art will appreciate that computing device 1100 may also include hardware devices that implement other additional functions, depending on the particular needs. Moreover, those skilled in the art will appreciate that computing device 1100 may also only include the components necessary to implement embodiments of the present invention, and does not necessarily include all of the devices shown in FIG.
图11所示的硬件结构以及上述描述适用于本发明实施例所提供的各种路由设备,适用于执行本发明实施例所提供的各种路由方法。The hardware structure shown in FIG. 11 and the foregoing description are applicable to various routing devices provided by the embodiments of the present invention, and are applicable to performing various routing methods provided by the embodiments of the present invention.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,设备和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实现时可以有另外的划分方式,例如多个模块或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或模块的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided by the present application, it should be understood that the disclosed systems, devices, and methods may be implemented in other manners. For example, the device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division, and may be implemented in another manner, for example, multiple modules or components may be combined or may be Integrate into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or module, and may be electrical, mechanical or otherwise.
所述作为分离部件说明的模块可以是或者也可以不是物理上分开的, 作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。The modules described as separate components may or may not be physically separate. The components displayed as modules may or may not be physical modules, that is, may be located in one place, or may be distributed to multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本发明各个实施例中的各功能模块可以集成在一个处理模块中,也可以是各个模块单独物理存在,也可以两个或两个以上模块集成在一个模块中。上述集成的模块既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module. The above integrated modules can be implemented in the form of hardware or in the form of hardware plus software function modules.
上述以软件功能模块的形式实现的集成的模块,可以存储在一个计算机可读取存储介质中。上述软件功能模块存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的部分步骤。而前述的存储介质包括:移动硬盘、只读存储器(英文:Read-Only Memory,简称ROM)、随机存取存储器(英文:Random Access Memory,简称RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The above-described integrated modules implemented in the form of software function modules can be stored in a computer readable storage medium. The software functional modules described above are stored in a storage medium and include instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform some of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: a mobile hard disk, a read-only memory (English: Read-Only Memory, ROM for short), a random access memory (English: Random Access Memory, RAM for short), a magnetic disk or an optical disk, and the like. The medium of the code.
最后应说明的是:以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的保护范围。 It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and are not limited thereto; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that The technical solutions described in the foregoing embodiments are modified, or some of the technical features are equivalently replaced; and the modifications or substitutions do not deviate from the technical scope of the embodiments of the present invention.

Claims (39)

  1. 一种路由方法,其特征在于,包括:A routing method, comprising:
    接收数据包,所述数据包中携带所述数据包的目的地址;Receiving a data packet, where the data packet carries a destination address of the data packet;
    在路由表中确定与所述目的地址对应的匹配条目,其中,所述路由表的条目中包含地址运算符和网络标识,所述匹配条目的网络标识的有效位与所述目的地址的有效位按照所述匹配条目的地址运算符进行运算的逻辑运算结果为真;Determining, in the routing table, a matching entry corresponding to the destination address, wherein the entry of the routing table includes an address operator and a network identifier, and a valid bit of the network identifier of the matching entry and a valid bit of the destination address The logical operation result of the operation according to the address operator of the matching entry is true;
    从根据所述匹配条目中输出端口信息确定的输出端口发送所述数据包。The data packet is transmitted from an output port determined according to output port information in the matching entry.
  2. 根据权利要求1所述的路由方法,其特征在于,所述网络标识的有效位为将所述网络标识当做的一个整体数值,所述目的地址的有效位是指将所述目的地址当做的一个整体数值。The routing method according to claim 1, wherein the valid bit of the network identifier is an overall value that treats the network identifier, and the valid bit of the destination address refers to a destination address. Overall value.
  3. 根据权利要求1所述的路由方法,其特征在于,所述路由表的条目中还包括掩码,所述目的地址的有效位为所述目的地址与所述掩码位与操作的结果当做的一个整体数值,所述网络标识的有效位为所述网络标识与所述掩码位与操作的结果当做的一个整体数值。The routing method according to claim 1, wherein the entry of the routing table further includes a mask, and the valid bit of the destination address is the result of the destination address and the mask bit and the operation result. An overall value, the valid bit of the network identifier is an overall value of the network identifier and the result of the mask bit and operation.
  4. 根据权利要求3所述的路由方法,其特征在于,所述掩码包括连续掩码和非连续掩码。The routing method according to claim 3, wherein the mask comprises a continuous mask and a non-continuous mask.
  5. 根据权利要求1-4任一项所述的路由方法,其特征在于,所述路由表的条目中还包括优先级信息,所述优先级信息用于指示所属条目的优先级;The routing method according to any one of claims 1-4, wherein the entry of the routing table further includes priority information, where the priority information is used to indicate a priority of the belonging entry;
    所述在路由表中确定与所述目的地址对应的匹配条目,包括:在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,并根据所述查找到的条目的优先级信息,从所述查找到的条目中,选择优先级最高的条目,作为所述匹配条目。Determining, in the routing table, a matching entry corresponding to the destination address, comprising: a logic for finding a valid bit of the network identifier of the entry in the routing table and a valid bit of the destination address according to an address operator of the entry The operation result is an entry, and according to the priority information of the found entry, the entry with the highest priority is selected from the searched entry as the matching entry.
  6. 根据权利要求1-4任一项所述的路由方法,其特征在于,所述在路由表中确定与所述目的地址对应的匹配条目,包括:按照优先级从高到低的顺序在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,将所述找到的第一个条目作为所述匹配条目,其中,所述查找表的条目按照优先级进行排 序。The routing method according to any one of claims 1 to 4, wherein the determining a matching entry corresponding to the destination address in the routing table comprises: routing the table according to a priority from highest to lowest The entry of the valid bit of the network identifier of the lookup entry and the valid bit of the destination address are logically operated according to the address operator of the entry, and the first entry found is used as the matching entry. Wherein the entries of the lookup table are ranked according to priority sequence.
  7. 根据权利要求1-6任一项所述的路由方法,其特征在于,所述从根据所述匹配条目中的输出端口信息确定的输出端口发送所述数据包包括:根据地址信息按照所述匹配条目中输出端口信息进行运算的结果,确定所述输出端口,并将所述数据包从所述输出端口进行发送,所述地址信息包括以下至少一种:所述目的地址、所述数据包的源地址、所述匹配条目的网络标识和当前节点地址。The routing method according to any one of claims 1 to 6, wherein the transmitting the data packet from an output port determined according to output port information in the matching entry comprises: matching according to the address information And outputting the port information in the entry, determining the output port, and transmitting the data packet from the output port, where the address information includes at least one of the following: the destination address, the data packet Source address, network identifier of the matching entry, and current node address.
  8. 根据权利要求1-6任一项所述的路由方法,其特征在于,所述从根据所述匹配条目中输出端口信息确定的输出端口发送所述数据包,包括:根据哈希算法从所述输出端口信息中记录的多个端口中选择一个端口作为所述输出端口,并将所述数据包从所述输出端口进行转发。The routing method according to any one of claims 1 to 6, wherein the transmitting the data packet from an output port determined according to output port information in the matching entry comprises: according to a hash algorithm One of the plurality of ports recorded in the output port information is selected as the output port, and the data packet is forwarded from the output port.
  9. 根据权利要求1-8任一项所述的路由方法,其特征在于,所述匹配条目还包含操作信息,所述操作信息用于指示对所述数据包进行操作,则根据所述匹配条目中输出端口信息确定的输出端口转发发送所述数据包之前,进一步包括:根据所述匹配条目中的操作信息,对所述数据包进行操作。The routing method according to any one of claims 1 to 8, wherein the matching entry further includes operation information, and the operation information is used to indicate that the data packet is operated according to the matching entry. Before the output port determined by the output port information forwards and sends the data packet, the method further includes: operating the data packet according to the operation information in the matching entry.
  10. 根据权利要求1-9任一项所述的路由方法,其特征在于,所述地址运算符包括:不等于、大于、小于、大于等于或小于等于。The routing method according to any one of claims 1 to 9, wherein the address operator comprises: not equal to, greater than, less than, greater than or equal to, or less than or equal to.
  11. 一种路由方法,其特征在于,包括:A routing method, comprising:
    接收数据包,所述数据包中携带所述数据包的目的地址;Receiving a data packet, where the data packet carries a destination address of the data packet;
    在路由表中确定与所述目的地址对应的匹配条目;Determining a matching entry corresponding to the destination address in the routing table;
    根据地址信息按照所述匹配条目中输出端口信息进行运算的结果,确定所述输出端口,并将所述数据包从所述输出端口进行发送,所述地址信息包括以下至少一种:所述目的地址、所述数据包的源地址、所述匹配条目的网络标识和当前节点地址。And determining, according to the result that the address information is operated according to the output port information in the matching entry, the output port, and sending the data packet from the output port, where the address information includes at least one of the following: The address, the source address of the data packet, the network identifier of the matching entry, and the current node address.
  12. 根据权利要求11所述的路由方法,其特征在于,所述路由表的条目中包含地址运算符和网络标识,所述匹配条目的网络标识的有效位与所述目的地址的有效位按照所述匹配条目的地址运算符进行运算的逻辑运算结果为真。The routing method according to claim 11, wherein the entry of the routing table includes an address operator and a network identifier, and a valid bit of the network identifier of the matching entry and a valid bit of the destination address are as described The logical operation of the operation of the matching address's address operator is true.
  13. 根据权利要求12所述的路由方法,其特征在于,所述网络标识的有效位为将所述网络标识当做的一个整体数值,所述目的地址的有效位是指将所述目的地址当做的一个整体数值。 The routing method according to claim 12, wherein the valid bit of the network identifier is an overall value that treats the network identifier, and the valid bit of the destination address refers to a destination address. Overall value.
  14. 根据权利要求12所述的路由方法,其特征在于,所述路由表的条目中还包括掩码,所述目的地址的有效位为所述目的地址与所述掩码位与操作的结果当做的一个整体数值,所述网络标识的有效位为所述网络标识与所述掩码位与操作的结果当做的一个整体数值。The routing method according to claim 12, wherein the entry of the routing table further includes a mask, and the valid bit of the destination address is the result of the destination address and the mask bit and the operation result. An overall value, the valid bit of the network identifier is an overall value of the network identifier and the result of the mask bit and operation.
  15. 根据权利要求14所述的路由方法,其特征在于,所述掩码包括连续掩码和非连续掩码。The routing method according to claim 14, wherein the mask comprises a continuous mask and a non-continuous mask.
  16. 根据权利要求12-15任一项所述的路由方法,其特征在于,所述路由表的条目中还包括优先级信息,所述优先级信息用于指示所属条目的优先级;The routing method according to any one of claims 12 to 15, wherein the entry of the routing table further includes priority information, where the priority information is used to indicate the priority of the belonging entry;
    所述在路由表中确定与所述目的地址对应的匹配条目,包括:在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,并根据所述查找到的条目的优先级信息,从所述查找到的条目中,选择优先级最高的条目,作为所述匹配条目。Determining, in the routing table, a matching entry corresponding to the destination address, comprising: a logic for finding a valid bit of the network identifier of the entry in the routing table and a valid bit of the destination address according to an address operator of the entry The operation result is an entry, and according to the priority information of the found entry, the entry with the highest priority is selected from the searched entry as the matching entry.
  17. 根据权利要求12-15任一项所述的路由方法,其特征在于,所述在路由表中确定与所述目的地址对应的匹配条目,包括:按照优先级从高到低的顺序在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,将所述找到的第一个条目作为所述匹配条目,其中,所述查找表的条目按照优先级进行排序。The routing method according to any one of claims 12-15, wherein the determining a matching entry corresponding to the destination address in the routing table comprises: routing the table according to a priority from highest to lowest The entry of the valid bit of the network identifier of the lookup entry and the valid bit of the destination address are logically operated according to the address operator of the entry, and the first entry found is used as the matching entry. The entries of the lookup table are sorted according to priority.
  18. 根据权利要求11-17任一项所述的路由方法,其特征在于,所述匹配条目还包含操作信息,所述操作信息用于指示对所述数据包进行操作,则根据所述匹配条目中输出端口信息确定的输出端口转发发送所述数据包之前,进一步包括:根据所述匹配条目中的操作信息,对所述数据包进行操作。The routing method according to any one of claims 11 to 17, wherein the matching entry further includes operation information, and the operation information is used to indicate that the data packet is operated, according to the matching entry. Before the output port determined by the output port information forwards and sends the data packet, the method further includes: operating the data packet according to the operation information in the matching entry.
  19. 根据权利要求12-18任一项所述的路由方法,其特征在于,所述地址运算符包括:不等于、大于、小于、大于等于或小于等于。The routing method according to any one of claims 12 to 18, wherein the address operator comprises: not equal to, greater than, less than, greater than or equal to, or less than or equal to.
  20. 一种计算设备,其特征在于,包括:处理器、存储器、总线和通信接口;A computing device, comprising: a processor, a memory, a bus, and a communication interface;
    所述存储器用于存储计算设备执行指令,所述处理器与所述存储器通过所述总线连接,当所述计算设备运行时,所述处理器执行所述存储器存储的所述计算机执行指令,以使所述计算设备执行权利要求1-19任一项所述的 方法。The memory is for storing a computing device execution instruction, the processor is coupled to the memory via the bus, and when the computing device is running, the processor executes the computer-executed instruction stored by the memory to Causing the computing device to perform the method of any of claims 1-19 method.
  21. 一种路由设备,其特征在于,包括:A routing device, comprising:
    接收单元,用于接收数据包,所述数据包中携带所述数据包的目的地址;a receiving unit, configured to receive a data packet, where the data packet carries a destination address of the data packet;
    匹配单元,用于在路由表中确定与所述目的地址对应的匹配条目,其中,所述路由表的条目中包含地址运算符和网络标识,所述匹配条目的网络标识的有效位与所述目的地址的有效位按照所述匹配条目的地址运算符进行运算的逻辑运算结果为真;a matching unit, configured to determine, in the routing table, a matching entry corresponding to the destination address, where the entry of the routing table includes an address operator and a network identifier, and a valid bit of the network identifier of the matching entry is The logical operation result of the valid bit of the destination address being operated according to the address operator of the matching entry is true;
    发送单元,用于从根据所述匹配条目中输出端口信息确定的输出端口发送所述数据包。And a sending unit, configured to send the data packet from an output port determined according to output port information in the matching entry.
  22. 根据权利要求21所述的路由设备,其特征在于,所述网络标识的有效位为将所述网络标识当做的一个整体数值,所述目的地址的有效位是指将所述目的地址当做的一个整体数值。The routing device according to claim 21, wherein the valid bit of the network identifier is an overall value that treats the network identifier, and the valid bit of the destination address refers to a destination address. Overall value.
  23. 根据权利要求21所述的路由设备,其特征在于,所述路由表的条目中还包括掩码,所述目的地址的有效位为所述目的地址与所述掩码位与操作的结果当做的一个整体数值,所述网络标识的有效位为所述网络标识与所述掩码位与操作的结果当做的一个整体数值。The routing device according to claim 21, wherein the entry of the routing table further includes a mask, and a valid bit of the destination address is a result of the destination address and the mask bit and operation result. An overall value, the valid bit of the network identifier is an overall value of the network identifier and the result of the mask bit and operation.
  24. 根据权利要求23所述的路由设备,其特征在于,所述掩码包括连续掩码和非连续掩码。The routing device of claim 23 wherein the mask comprises a continuous mask and a non-continuous mask.
  25. 根据权利要求21-24任一项所述的路由设备,其特征在于,所述路由表的条目中还包括优先级信息,所述优先级信息用于指示所属条目的优先级;The routing device according to any one of claims 21 to 24, wherein the entry of the routing table further includes priority information, where the priority information is used to indicate the priority of the belonging entry;
    所述匹配单元用于在路由表中确定与所述目的地址对应的匹配条目,包括:所述匹配单元在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,并根据所述查找到的条目的优先级信息,从所述查找到的条目中,选择优先级最高的条目,作为所述匹配条目。The matching unit is configured to determine, in the routing table, a matching entry corresponding to the destination address, including: the matching unit searches for a valid bit of the network identifier of the entry in the routing table, and a valid bit of the destination address according to the entry The logical operation result of the operation performed by the address operator is a true entry, and based on the priority information of the found entry, an entry having the highest priority is selected from the searched entry as the matching entry.
  26. 根据权利要求21-24任一项所述的路由设备,其特征在于,所述匹配单元用于在路由表中确定与所述目的地址对应的匹配条目,包括:所述匹配单元按照优先级从高到低的顺序在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,将所述找到的第一个条目作为所述匹配条目,其中,所述 查找表的条目按照优先级进行排序。The routing device according to any one of claims 21 to 24, wherein the matching unit is configured to determine, in the routing table, a matching entry corresponding to the destination address, including: the matching unit according to a priority High to low order in the routing table to find the valid bit of the network identifier of the entry and the valid bit of the destination address in accordance with the address operator of the entry operation logical operation result is true entry, the first found Entries as the matching entry, wherein the The entries of the lookup table are sorted by priority.
  27. 根据权利要求21-26任一项所述的路由设备,其特征在于,所述发送单元用于从根据所述匹配条目中的输出端口信息确定的输出端口发送所述数据包包括:所述发送单元根据地址信息按照所述匹配条目中输出端口信息进行运算的结果,确定所述输出端口,并将所述数据包从所述输出端口进行发送,所述地址信息包括以下至少一种:所述目的地址、所述数据包的源地址、所述匹配条目的网络标识和当前节点地址。The routing device according to any one of claims 21 to 26, wherein the transmitting unit is configured to send the data packet from an output port determined according to output port information in the matching entry, including: the sending The unit determines the output port according to the result of the operation of the output port information in the matching entry according to the address information, and sends the data packet from the output port, where the address information includes at least one of the following: The destination address, the source address of the data packet, the network identifier of the matching entry, and the current node address.
  28. 根据权利要求21-26任一项所述的路由设备,其特征在于,所述发送单元用于从根据所述匹配条目中的输出端口信息确定的输出端口发送所述数据包包括:所述发送单元根据哈希算法从所述输出端口信息中记录的多个端口中选择一个端口作为所述输出端口,并将所述数据包从所述输出端口进行转发。The routing device according to any one of claims 21 to 26, wherein the transmitting unit is configured to send the data packet from an output port determined according to output port information in the matching entry, including: the sending The unit selects one of the plurality of ports recorded in the output port information as the output port according to a hash algorithm, and forwards the data packet from the output port.
  29. 根据权利要求21-28任一项所述的路由设备,其特征在于,所述设备还包括操作单元,所述匹配条目还包含操作信息,所述操作信息用于指示对所述数据包进行操作,所述操作单元用于根据所述匹配条目中的操作信息,对所述数据包进行操作。The routing device according to any one of claims 21 to 28, wherein the device further comprises an operation unit, the matching entry further comprises operation information, the operation information is used to indicate that the data packet is operated The operation unit is configured to operate the data packet according to the operation information in the matching entry.
  30. 根据权利要求21-29任一项所述的路由设备,其特征在于,所述地址运算符包括:不等于、大于、小于、大于等于或小于等于。The routing device according to any one of claims 21 to 29, wherein the address operator comprises: not equal to, greater than, less than, greater than or equal to, or less than or equal to.
  31. 一种路由设备,其特征在于,包括:A routing device, comprising:
    接收单元,用于接收数据包,所述数据包中携带所述数据包的目的地址;a receiving unit, configured to receive a data packet, where the data packet carries a destination address of the data packet;
    匹配单元,用于在路由表中确定与所述目的地址对应的匹配条目;a matching unit, configured to determine, in the routing table, a matching entry corresponding to the destination address;
    发送单元,用于根据地址信息按照所述匹配条目中输出端口信息进行运算的结果,确定所述输出端口,并将所述数据包从所述输出端口进行发送,所述地址信息包括以下至少一种:所述目的地址、所述数据包的源地址、所述匹配条目的网络标识和当前节点地址。a sending unit, configured to determine, according to the result that the address information is operated according to the output port information in the matching entry, the output port, and send the data packet from the output port, where the address information includes at least one of the following The destination address, the source address of the data packet, the network identifier of the matching entry, and the current node address.
  32. 根据权利要求31所述的路由设备,其特征在于,所述路由表的条目中包含地址运算符和网络标识,所述匹配条目的网络标识的有效位与所述目的地址的有效位按照所述匹配条目的地址运算符进行运算的逻辑运算结果为真。The routing device according to claim 31, wherein the entry of the routing table includes an address operator and a network identifier, and a valid bit of the network identifier of the matching entry and a valid bit of the destination address are as described The logical operation of the operation of the matching address's address operator is true.
  33. 根据权利要求32所述的路由设备,其特征在于,所述网络标识的有效位为将所述网络标识当做的一个整体数值,所述目的地址的有效位是指 将所述目的地址当做的一个整体数值。The routing device according to claim 32, wherein the valid bit of the network identifier is an overall value of the network identifier, and the valid bit of the destination address is The destination address is treated as an overall value.
  34. 根据权利要求32所述的路由设备,其特征在于,所述路由表的条目中还包括掩码,所述目的地址的有效位为所述目的地址与所述掩码位与操作的结果当做的一个整体数值,所述网络标识的有效位为所述网络标识与所述掩码位与操作的结果当做的一个整体数值。The routing device according to claim 32, wherein the entry of the routing table further includes a mask, and the valid bit of the destination address is the result of the destination address and the mask bit and the operation result. An overall value, the valid bit of the network identifier is an overall value of the network identifier and the result of the mask bit and operation.
  35. 根据权利要求34所述的路由设备,其特征在于,所述掩码包括连续掩码和非连续掩码。The routing device of claim 34 wherein the mask comprises a continuous mask and a non-continuous mask.
  36. 根据权利要求32-35任一项所述的路由设备,其特征在于,所述路由表的条目中还包括优先级信息,所述优先级信息用于指示所属条目的优先级;The routing device according to any one of claims 32 to 35, wherein the entry of the routing table further includes priority information, where the priority information is used to indicate a priority of the belonging entry;
    所述匹配单元用于在路由表中确定与所述目的地址对应的匹配条目,包括:所述匹配单元在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,并根据所述查找到的条目的优先级信息,从所述查找到的条目中,选择优先级最高的条目,作为所述匹配条目。The matching unit is configured to determine, in the routing table, a matching entry corresponding to the destination address, including: the matching unit searches for a valid bit of the network identifier of the entry in the routing table, and a valid bit of the destination address according to the entry The logical operation result of the operation performed by the address operator is a true entry, and based on the priority information of the found entry, an entry having the highest priority is selected from the searched entry as the matching entry.
  37. 根据权利要求32-35任一项所述的路由设备,其特征在于,所述匹配单元用于在路由表中确定与所述目的地址对应的匹配条目,包括:所述匹配单元按照优先级从高到低的顺序在路由表中查找条目的网络标识的有效位与所述目的地址的有效位按照该条目的地址运算符进行运算的逻辑运算结果为真的条目,将所述找到的第一个条目作为所述匹配条目,其中,所述查找表的条目按照优先级进行排序。The routing device according to any one of claims 32 to 35, wherein the matching unit is configured to determine, in the routing table, a matching entry corresponding to the destination address, including: the matching unit according to a priority High to low order in the routing table to find the valid bit of the network identifier of the entry and the valid bit of the destination address in accordance with the address operator of the entry operation logical operation result is true entry, the first found The entries are the matching entries, wherein the entries of the lookup table are ordered by priority.
  38. 根据权利要求31-37任一项所述的路由设备,其特征在于,所述设备还包括操作单元,所述匹配条目还包含操作信息,所述操作信息用于指示对所述数据包进行操作,所述操作单元用于根据所述匹配条目中的操作信息,对所述数据包进行操作。The routing device according to any one of claims 31 to 37, wherein the device further comprises an operation unit, the matching entry further comprises operation information, the operation information is used to indicate that the data packet is operated The operation unit is configured to operate the data packet according to the operation information in the matching entry.
  39. 根据权利要求32-38任一项所述的路由设备,其特征在于,所述地址运算符包括:等于、不等于、大于、小于、大于等于或小于等于。 The routing device according to any one of claims 32-38, wherein the address operator comprises: equal to, not equal to, greater than, less than, greater than or equal to, or less than or equal to.
PCT/CN2014/095351 2014-12-29 2014-12-29 Routing method and device WO2016106506A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2014/095351 WO2016106506A1 (en) 2014-12-29 2014-12-29 Routing method and device
CN201480037879.5A CN106170956B (en) 2014-12-29 2014-12-29 A kind of method for routing and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2014/095351 WO2016106506A1 (en) 2014-12-29 2014-12-29 Routing method and device

Publications (1)

Publication Number Publication Date
WO2016106506A1 true WO2016106506A1 (en) 2016-07-07

Family

ID=56283795

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/095351 WO2016106506A1 (en) 2014-12-29 2014-12-29 Routing method and device

Country Status (2)

Country Link
CN (1) CN106170956B (en)
WO (1) WO2016106506A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111698169A (en) * 2020-05-29 2020-09-22 中国航空工业集团公司西安航空计算技术研究所 Communication port extraction method based on frame content

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109617927B (en) * 2019-01-30 2021-04-16 新华三信息安全技术有限公司 Method and device for matching security policy
CN110401602B (en) * 2019-07-23 2022-07-12 苏州浪潮智能科技有限公司 Flow table determining method and device for network port
CN113497763A (en) * 2020-03-19 2021-10-12 华为技术有限公司 Route searching device and method and data forwarding equipment
CN114050997B (en) 2020-07-23 2023-06-09 美商光禾科技股份有限公司 Method and system for processing packets according to table lookup
CN114124704B (en) * 2021-11-19 2024-01-23 北京天融信网络安全技术有限公司 Route optimization method, device, electronic equipment and storage medium
CN114338525B (en) * 2021-12-28 2023-07-21 中国电信股份有限公司 Automatic route aggregation method and device, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6061712A (en) * 1998-01-07 2000-05-09 Lucent Technologies, Inc. Method for IP routing table look-up
CN102970150A (en) * 2011-09-01 2013-03-13 日电(中国)有限公司 Extensible multicast forwarding method and device for data center (DC)
CN104168201A (en) * 2014-08-06 2014-11-26 福建星网锐捷网络有限公司 Multipath forwarding method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6061712A (en) * 1998-01-07 2000-05-09 Lucent Technologies, Inc. Method for IP routing table look-up
CN102970150A (en) * 2011-09-01 2013-03-13 日电(中国)有限公司 Extensible multicast forwarding method and device for data center (DC)
CN104168201A (en) * 2014-08-06 2014-11-26 福建星网锐捷网络有限公司 Multipath forwarding method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111698169A (en) * 2020-05-29 2020-09-22 中国航空工业集团公司西安航空计算技术研究所 Communication port extraction method based on frame content
CN111698169B (en) * 2020-05-29 2022-04-05 中国航空工业集团公司西安航空计算技术研究所 Communication port extraction method based on frame content

Also Published As

Publication number Publication date
CN106170956B (en) 2019-04-12
CN106170956A (en) 2016-11-30

Similar Documents

Publication Publication Date Title
WO2016106506A1 (en) Routing method and device
US11018898B2 (en) Multicast multipathing in an overlay network
WO2019128817A1 (en) Message processing method and device
KR102162730B1 (en) Technologies for distributed routing table lookup
CN105122745A (en) Efficient longest prefix matching techniques for network devices
US9774532B2 (en) Information processing system, information processing apparatus and control method of information processing system
Ozdag Intel® Ethernet switch FM6000 series-software defined networking
CN106664261A (en) Method, device, and system for configuring flow entries
WO2021226948A1 (en) Data packet processing method and device based on open virtual switch (ovs)
WO2016029684A1 (en) Packet processing and forwarding device and method, and computer storage medium
CN107547407B (en) Message transmission method, device and implementation device
WO2015125801A1 (en) Network control method, network system, device, and program
TW201832092A (en) Virtual dedicated network and rule table generation method and apparatus, and routing method
CN109921995B (en) Method for configuring address table, FPGA and network equipment applying FPGA
WO2022048412A1 (en) Method for generating table item, method for sending message, device, and system
US20140254611A1 (en) System and method for reduced forwarding information storage
Yang et al. Fast OpenFlow table lookup with fast update
US20150124808A1 (en) Network System and Network Relay Device
JP5050978B2 (en) Transmission information transfer apparatus and method
CN108092896B (en) Stacking system and aggregation group creation apparatus
CN112787938A (en) Routing table item configuration method and device
CN114978808B (en) Data forwarding method and device, electronic equipment and storage medium
US9979650B1 (en) Forwarding packets using a probabilistic filter and a grouping technique
US20140029621A1 (en) Method for learning media access control address, network device, and system
GB2514634A (en) Dynamic multicast state aggregation in transport networks

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

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14909319

Country of ref document: EP

Kind code of ref document: A1