CN117097661B - Data packet forwarding method and device, storage medium and electronic equipment - Google Patents

Data packet forwarding method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN117097661B
CN117097661B CN202311348891.5A CN202311348891A CN117097661B CN 117097661 B CN117097661 B CN 117097661B CN 202311348891 A CN202311348891 A CN 202311348891A CN 117097661 B CN117097661 B CN 117097661B
Authority
CN
China
Prior art keywords
routing node
target
forwarding
data packet
type
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN202311348891.5A
Other languages
Chinese (zh)
Other versions
CN117097661A (en
Inventor
陈静静
李树青
孙华锦
高娜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Metabrain Intelligent Technology Co Ltd
Original Assignee
Suzhou Metabrain Intelligent Technology Co Ltd
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 Suzhou Metabrain Intelligent Technology Co Ltd filed Critical Suzhou Metabrain Intelligent Technology Co Ltd
Priority to CN202311348891.5A priority Critical patent/CN117097661B/en
Publication of CN117097661A publication Critical patent/CN117097661A/en
Application granted granted Critical
Publication of CN117097661B publication Critical patent/CN117097661B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/56Routing software
    • H04L45/566Routing instructions carried by the data packet, e.g. active networks

Landscapes

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

Abstract

The embodiment of the application provides a forwarding method and device of a data packet, a storage medium and electronic equipment, wherein the method comprises the following steps: under the condition that a first routing node in a target network acquires a target data packet, determining whether the target data packet carries a forwarding identifier, wherein the forwarding identifier is used for indicating a forwarding mode of the target data packet; under the condition that the target data packet does not carry the forwarding identifier and the target data packet is judged to need to be forwarded to the routing node in the target network, determining the forwarding routing node and the corresponding forwarding identifier; setting a forwarding identifier in the target data packet, and forwarding the target data packet to a forwarding routing node according to the forwarding identifier; and forwarding the target data packet according to the node type of the first routing node, the node type of the second routing node and the forwarding identifier under the condition that the forwarding identifier is carried in the target data packet, wherein the second routing node is a node which sends the target data packet to the first routing node in the target network.

Description

Data packet forwarding method and device, storage medium and electronic equipment
Technical Field
The embodiment of the application relates to the field of information transmission, in particular to a data packet forwarding method and device, a storage medium and electronic equipment.
Background
The routing algorithm is divided into a shortest path algorithm (shown as a in fig. 1, wherein a circle in the figure is a routing node) and an adaptive algorithm, and the principle of the adaptive routing algorithm is as follows: the shortest path is preferentially selected in the routing process, and the routing path can be selected according to the network condition and the rule in the case that the shortest path is occupied (as shown by b in fig. 1). In a routing-based network, if a shortest path algorithm is used, the algorithm is simple and does not produce deadlock, but the routing path cannot be adjusted according to the busy condition of the network, if an adaptive routing algorithm is used, path diversity is increased but because the network topology contains a "ring" which is a ring topology as shown in fig. 2, the deadlock is easily produced if an adaptive routing algorithm is used.
For example, suppose three route requests are simultaneously: request 1: the first-level routing node 0 to the first-level routing node 1; request 2: the secondary routing node 0 to the primary routing node 0; request 3: a first-level routing node 1 to a second-level routing node 0; when all of the shortest paths of the three routing requests are occupied, all clockwise routes are selected, and all intermediate routing nodes are occupied, deadlock occurs, as shown in fig. 3.
For example, suppose three route requests are simultaneously: request 1: a first-level routing node 0 to a second-level routing node 0; request 2: a first-level routing node 1 to a first-level routing node 0; request 3: the secondary routing node 0 to the primary routing node 1; when all of the shortest paths of the three routing requests are occupied, all of the shortest paths select a counterclockwise route, and all of the shortest paths occupy the intermediate routing nodes, a deadlock is generated, as shown in fig. 4.
Aiming at the problem that in the related art, when a ring topology structure exists in a routing-based network, a self-adaptive routing algorithm is used for forwarding a message, so that deadlock is easy to generate, no effective solution is proposed at present.
Accordingly, there is a need for improvements in the related art to overcome the drawbacks of the related art.
Disclosure of Invention
The embodiment of the application provides a forwarding method and device of a data packet, a storage medium and electronic equipment, which are used for at least solving the problem that a self-adaptive routing algorithm is used for forwarding a message so as to easily cause deadlock under the condition that a ring topology structure exists in a network based on routing.
According to one embodiment of the present application, there is provided a forwarding method for a data packet, including: under the condition that a first routing node in a target network acquires a target data packet, determining whether the target data packet carries a forwarding identifier, wherein the forwarding identifier is used for indicating a forwarding mode of the target data packet; judging whether the target data packet needs to be forwarded to a routing node in the target network or not under the condition that the forwarding identifier is not carried in the target data packet; under the condition that the target data packet is judged to need to be forwarded to a routing node in the target network, determining a forwarding routing node and a corresponding forwarding identifier; setting the forwarding identifier in the target data packet, and forwarding the target data packet to the forwarding routing node according to the forwarding identifier; and forwarding the target data packet according to the node type of the first routing node, the node type of a second routing node and the forwarding identifier under the condition that the forwarding identifier is carried in the target data packet, wherein the second routing node is a node which sends the target data packet to the first routing node in the target network.
In an exemplary embodiment, the target network includes a plurality of routing nodes, the plurality of routing nodes including: a first type of routing node, a second type of routing node, a third type of routing node; each second type of routing node in the target network is connected with two first type of routing nodes, two data transmission channels are arranged between each routing node in the two first types of routing nodes, each second type of routing node in the target network is connected with each third type of routing node in the target network, and each routing node in the target network is connected with a target number of ports, wherein the ports are used for receiving and sending data packets.
In an exemplary embodiment, determining whether the target data packet needs to be forwarded to a routing node in the target network includes: acquiring a source port number of a source port and a target port number of a target port from the target data packet, wherein the target data packet is a data packet acquired from the source port by the first routing node, and the target data packet is to be forwarded to the target port; judging whether the first type of routing nodes corresponding to the source port and the target port in the target network are the same according to the source port number and the target port number; and under the condition that the source port and the target port are different in the corresponding routing nodes of the first type in the target network, judging that the target data packet needs to be forwarded to the routing nodes in the target network.
In an exemplary embodiment, the method further comprises: under the condition that the source port and the target port are the same in the corresponding routing nodes of the first type in the target network, judging that the target data packet does not need to be forwarded to the routing nodes in the target network; forwarding the target data packet to the target port through the first routing node.
In one exemplary embodiment, determining a forwarding routing node and corresponding forwarding identification includes: judging whether the second type of routing nodes corresponding to the source port and the target port in the target network are the same according to the source port number and the target port number; determining whether a data transmission channel between the first routing node and a third routing node is occupied or not under the condition that the source port and the target port are different in the corresponding routing nodes of the second type in the target network, wherein the third routing node is the routing node of the second type which is directly connected with the first routing node in the target network; and determining a forwarding routing node and a corresponding forwarding identifier according to the occupation condition of the data transmission channel between the first routing node and the third routing node.
In an exemplary embodiment, determining the forwarding routing node and the corresponding forwarding identifier according to the occupancy of the data transmission channel between the first routing node and the third routing node includes: under the condition that a data transmission channel is unoccupied between the first routing node and the third routing node, determining that the forwarding routing node is the third routing node, and determining a corresponding forwarding identifier as a first identifier, wherein the first identifier is used for indicating the forwarding of the target data packet based on a shortest path; under the condition that data transmission channels between the first routing node and the third routing node are occupied, determining the forwarding routing node as a fourth routing node, wherein the fourth routing node is the first type routing node connected with the first routing node in the target network; and under the condition that the target data transmission channel between the first routing node and the fourth routing node is used for transmitting the data packet, determining a corresponding forwarding identifier as a second identifier corresponding to the target data transmission channel, wherein the second identifier is used for indicating that the target data packet is not forwarded based on a shortest path and the target data transmission channel is required to be used for forwarding.
In an exemplary embodiment, the method further comprises: determining whether a data transmission channel between the first routing node and a fourth routing node is occupied or not under the condition that the source port and the target port are the same in a corresponding routing node of a second type in the target network, wherein the fourth routing node is the routing node of the first type connected with the first routing node in the target network; and determining a forwarding routing node and a corresponding forwarding identifier according to the occupation condition of the data transmission channel between the first routing node and the fourth routing node.
In an exemplary embodiment, determining the forwarding routing node and the corresponding forwarding identifier according to the occupancy of the data transmission channel between the first routing node and the fourth routing node includes: under the condition that a data transmission channel is unoccupied between the first routing node and the fourth routing node, determining that the forwarding routing node is the fourth routing node, and determining a corresponding forwarding identifier as a first identifier, wherein the first identifier is used for indicating the forwarding of the target data packet based on a shortest path; under the condition that data transmission channels between the first routing node and the fourth routing node are occupied, determining the forwarding routing node as a third routing node, wherein the third routing node is the second type routing node connected with the first routing node in the target network; and under the condition that the target data transmission channel between the first routing node and the third routing node is used for transmitting the data packet, determining a corresponding forwarding identifier as a second identifier corresponding to the target data transmission channel, wherein the second identifier is used for indicating that the target data packet is not forwarded based on a shortest path and the target data transmission channel is required to be used for forwarding.
In an exemplary embodiment, determining whether the first type of routing nodes corresponding to the source port and the destination port in the destination network are the same according to the source port number and the destination port number includes: dividing the target port number by a first threshold value to obtain a first result; dividing the source port number by the first threshold value to obtain a second result; determining that the corresponding first type routing nodes of the source port and the target port in the target network are the same under the condition that the whole digits of the first result and the second result are the same; wherein the first threshold is equal to the target number; determining that the corresponding first type of routing nodes of the source port and the target port in the target network are different under the condition that the integral digits of the first result and the second result are different; judging whether the second type of routing nodes corresponding to the source port and the target port in the target network are the same according to the source port number and the target port number, including: dividing the target port number by a second threshold value to obtain a third result; dividing the source port number by the second threshold value to obtain a fourth result; determining that the corresponding second type routing nodes of the source port and the target port in the target network are the same under the condition that the third result and the fourth result are the same in integer digits; wherein the second threshold is equal to twice the target number; and under the condition that the third result is different from the fourth result in integer digits, determining that the corresponding second type of routing nodes of the source port and the target port in the target network are different.
In an exemplary embodiment, forwarding the target data packet to the forwarding routing node according to the forwarding identification: when the forwarding identifier indicates a data transmission channel, forwarding the target data packet to the forwarding routing node by using the data transmission channel indicated by the forwarding identifier; and forwarding the target data packet to the forwarding routing node by using an unoccupied data transmission channel between the first routing node and the forwarding routing node under the condition that the forwarding identifier does not indicate the data transmission channel.
In an exemplary embodiment, forwarding the target data packet according to the node type of the first routing node, the node type of the second routing node, and the forwarding identifier includes: forwarding the target data packet to the target port according to the target port number of the target port carried in the target data packet when the node type of the first routing node is the first type, the node type of the second routing node is the second type, and the forwarding identifier is the first identifier; when the node type of the first routing node is the first type, the node type of the second routing node is the second type, and the forwarding identifier is the second identifier, modifying the forwarding identifier in the target data packet to the first identifier, and forwarding the target data packet to a fourth routing node through a data transmission channel different from a target data transmission channel in two data transmission channels between the first routing node and the fourth routing node; the fourth routing node is the first type of routing node connected with the first routing node in the target network; the first identifier is used for indicating that the target data packet is forwarded based on a shortest path, and the second identifier is used for indicating that the target data packet is not forwarded based on the shortest path and is required to be forwarded by using the target data transmission channel.
In an exemplary embodiment, forwarding the target data packet according to the node type of the first routing node, the node type of the second routing node, and the forwarding identifier includes: forwarding the target data packet to the target port according to the target port number of the target port carried in the target data packet when the node type of the first routing node is the first type, the node type of the second routing node is the first type, and the forwarding identifier is the first identifier; when the node type of the first routing node is the first type, the node type of the second routing node is the first type, and the forwarding identifier is the second identifier, modifying the forwarding identifier in the target data packet to the first identifier, and forwarding the target data packet to a third routing node through a data transmission channel different from a target data transmission channel in two data transmission channels between the first routing node and the third routing node; wherein the third routing node is the second type of routing node connected to the first routing node in the target network; the first identifier is used for indicating that the target data packet is forwarded based on a shortest path, and the second identifier is used for indicating that the target data packet is not forwarded based on the shortest path and is required to be forwarded by using the target data transmission channel.
In an exemplary embodiment, forwarding the target data packet according to the node type of the first routing node, the node type of the second routing node, and the forwarding identifier includes: forwarding the target data packet to a fifth routing node under the condition that the node type of the first routing node is the second type, the node type of the second routing node is the first type, and the forwarding identifier is the first identifier, wherein the fifth routing node is a routing node of a third type connected with the first routing node in the target network; when the node type of the first routing node is the second type, the node type of the second routing node is the first type, and the forwarding identifier is the second identifier, modifying the forwarding identifier in the target data packet to the first identifier, and forwarding the target data packet to a sixth routing node through a data transmission channel different from a target data transmission channel in two data transmission channels between the first routing node and the sixth routing node; the sixth routing node is a routing node different from the second routing node in two routing nodes of a first type, which are connected with the first routing node, in the target network, the first identifier is used for indicating that the target data packet is forwarded based on a shortest path, and the second identifier is used for indicating that the target data packet is not forwarded based on the shortest path and is required to be forwarded by using the target data transmission channel.
In an exemplary embodiment, before forwarding the target data packet to the fifth routing node, the method further comprises: and determining a fifth routing node with unoccupied data transmission channels from a plurality of routing nodes of a third type connected with the first routing node in the target network.
In an exemplary embodiment, forwarding the target data packet according to the node type of the first routing node, the node type of the second routing node, and the forwarding identifier includes: determining a seventh routing node according to a target port number of a target port carried in the target data packet when the node type of the first routing node is the second type, the node type of the second routing node is the third type, and the forwarding identifier is a first identifier, wherein the seventh routing node is a routing node of a first type corresponding to the target port in the target network, and the first identifier is used for indicating that the target data packet is forwarded based on a shortest path; forwarding the target data packet to the seventh routing node.
In an exemplary embodiment, determining the seventh routing node according to the destination port number of the destination port carried in the destination data packet includes: dividing the target port number by a first threshold to obtain a fifth result, wherein the first threshold is equal to the target number; determining a first preset routing node of two first types of routing nodes corresponding to the first routing node in the target network as the seventh routing node under the condition that the integer digits of the fifth result are even; and under the condition that the integer digits of the fifth result are odd numbers, determining a second preset routing node as the seventh routing node in two first type routing nodes corresponding to the first routing node in the target network.
In an exemplary embodiment, forwarding the target data packet to the seventh routing node includes: determining whether a data transmission channel between the first routing node and the seventh routing node is occupied; directly forwarding the target data packet to the seventh routing node under the condition that a data transmission channel is unoccupied between the first routing node and the seventh routing node; when the data transmission channels between the first routing node and the seventh routing node are occupied and the data packet transmission is determined to be carried out by using a target data transmission channel between the first routing node and an eighth routing node, modifying a forwarding identifier in the target data packet to a second identifier corresponding to the target data transmission channel, and forwarding the target data packet to the eighth routing node so as to forward the target data packet to the seventh routing node through the eighth routing node; the eighth routing node is a routing node different from the seventh routing node among two routing nodes of the first type connected with the first routing node in the target network, and the second identifier is used for indicating that the target data packet is not forwarded based on a shortest path and is required to be forwarded by using the target data transmission channel.
In an exemplary embodiment, forwarding the target data packet according to the node type of the first routing node, the node type of the second routing node, and the forwarding identifier includes: determining a ninth routing node according to a target port number of a target port carried in the target data packet when the node type of the first routing node is the third type, the node type of the second routing node is the second type, and the forwarding identifier is a first identifier, wherein the ninth routing node is a routing node of the second type corresponding to the target port in the target network, and the first identifier is used for indicating that the target data packet is forwarded based on a shortest path; forwarding the target data packet to the ninth routing node.
In an exemplary embodiment, determining the ninth routing node according to the destination port number of the destination port carried in the destination data packet includes: dividing the target port number by a second threshold to obtain a sixth result, wherein the second threshold is equal to twice the target number; and determining the routing node numbered as the integer digit of the sixth result in the target network as the ninth routing node.
According to still another embodiment of the present application, there is provided a forwarding apparatus for a data packet, including: the determining module is used for determining whether a forwarding identifier is carried in a target data packet or not under the condition that a first routing node in a target network acquires the target data packet, wherein the forwarding identifier is used for indicating a forwarding mode of the target data packet; the first forwarding module is used for judging whether the target data packet needs to be forwarded to a routing node in the target network or not under the condition that the forwarding identifier is not carried in the target data packet; determining a forwarding routing node and a corresponding forwarding identifier under the condition that the target data packet is judged to need to be forwarded to the routing node in the target network; setting the forwarding identifier in the target data packet, and forwarding the target data packet to the forwarding routing node according to the forwarding identifier; and the second forwarding module is used for forwarding the target data packet according to the node type of the first routing node, the node type of a second routing node and the forwarding identifier under the condition that the forwarding identifier is carried in the target data packet, wherein the second routing node is a node which sends the target data packet to the first routing node in the target network.
According to a further embodiment of the present application, there is also provided a computer readable storage medium having stored therein a computer program, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
According to a further embodiment of the present application, there is also provided an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
In the method, under the condition that a first routing node in a target network acquires a target data packet, whether the target data packet carries a forwarding identifier is determined, wherein the forwarding identifier is used for indicating a forwarding mode of the target data packet; judging whether the target data packet needs to be forwarded to a routing node in the target network or not under the condition that the forwarding identifier is not carried in the target data packet; under the condition that the target data packet is judged to need to be forwarded to a routing node in a target network, determining a forwarding routing node and a corresponding forwarding identifier; setting the forwarding identifier in the target data packet, and forwarding the target data packet to a forwarding routing node according to the forwarding identifier; and forwarding the target data packet according to the node type of the first routing node, the node type of the second routing node and the forwarding identifier under the condition that the target data packet carries the forwarding identifier, wherein the second routing node is a node which sends the target data packet to the first routing node in the target network. That is, the forwarding identifier is set in the data packet, and the routing path for forwarding the data packet by the routing node is further limited, so that the problem that the message forwarding is easy to produce deadlock by using the self-adaptive routing algorithm under the condition that a ring topology structure exists in a network based on routing is solved, and the technical effect of avoiding the deadlock phenomenon is achieved.
Drawings
FIG. 1 is a schematic diagram of a shortest route algorithm and an adaptive routing algorithm;
FIG. 2 is a schematic diagram of a ring topology between routing nodes in a network;
FIG. 3 is a schematic diagram of a clockwise deadlock;
FIG. 4 is a schematic diagram of a counterclockwise deadlock;
fig. 5 is a hardware block diagram of a server of a forwarding method of a data packet according to an embodiment of the present application;
fig. 6 is a flowchart of a method for forwarding a data packet according to an embodiment of the present application;
FIG. 7 is a schematic diagram of a bi-directional two-level CLOS network;
FIG. 8 is a schematic diagram of a packet-based modified CLOS network, according to an embodiment of the present application;
FIG. 9 is a schematic diagram of a path between routing nodes according to an embodiment of the present application;
FIG. 10 is a schematic diagram of a shortest path according to an embodiment of the present application;
FIG. 11 is a schematic diagram of a non-shortest path according to an embodiment of the present application;
FIG. 12 is a schematic diagram of non-shortest path forwarding based data packets according to an embodiment of the present application;
fig. 13 is a block diagram of a forwarding device for a data packet according to an embodiment of the present application.
Detailed Description
Embodiments of the present application will be described in detail below with reference to the accompanying drawings in conjunction with the embodiments.
It should be noted that the terms "first," "second," and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.
The method embodiment provided in the embodiment of the present application may be performed in a server, and fig. 5 is a hardware structural block diagram of the server according to a forwarding method of a data packet in the embodiment of the present application. As shown in fig. 5, the server may include one or more processors 502 (only one is shown in fig. 5) (the processor 502 may include, but is not limited to, a microprocessor MCU or a processing device such as a programmable logic device FPGA) and a memory 504 for storing data, where the server may further include a transmission device 506 for communication functions and an input-output device 508. It will be appreciated by those skilled in the art that the structure shown in fig. 5 is merely illustrative, and is not intended to limit the structure of the server described above. For example, the server may also include more or fewer components than shown in FIG. 5, or have a different configuration than shown in FIG. 5.
The memory 504 may be used to store a computer program, for example, a software program of application software and a module, such as a computer program corresponding to a packet forwarding method in the embodiment of the present application, and the processor 502 executes the computer program stored in the memory 504 to perform various functional applications and data processing, that is, implement the method described above. Memory 504 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, memory 504 may further include memory located remotely from processor 502, which may be connected to the server via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 506 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of a server. In one example, the transmission device 506 includes a network adapter (Network Interface Controller, simply referred to as NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 506 may be a Radio Frequency (RF) module, which is used to communicate with the internet wirelessly.
Fig. 6 is a flowchart of a method for forwarding a data packet according to an embodiment of the present application, including but not limited to being performed by a first routing node, as shown in fig. 6, the flowchart includes the following steps S602-S606:
step S602: under the condition that a first routing node in a target network acquires a target data packet, determining whether the target data packet carries a forwarding identifier, wherein the forwarding identifier is used for indicating a forwarding mode of the target data packet;
as an alternative example, the forwarding identity may be represented by 2 bits.
In one exemplary embodiment, a target network includes a plurality of routing nodes therein, the plurality of routing nodes including: a first type of routing node, a second type of routing node, a third type of routing node; each second type of routing node in the target network is connected with two first type of routing nodes, two data transmission channels are arranged between each routing node in the two first types of routing nodes, each second type of routing node in the target network is connected with each third type of routing node in the target network, and each routing node in the target network is connected with a target number of ports, wherein the ports are used for receiving and sending data packets.
It should be noted that, the two data transmission channels between each first type of routing node and the other connected first type of routing node or the second type of routing node include two types of data transmission channels, where the target data transmission channel is one of the two types of data transmission channels.
As an alternative example, the target network is an improved network-on-chip (which will be described in detail later), and fig. 8 illustrates a network topology diagram thereof, as shown in fig. 8, in which each link can bidirectionally transmit data, that is, is full duplex; the boxes in the figure represent ports, 48 total, from 000000 (port 0) to 101111 (port 47) can be represented by 6bit binary numbers; the circles in the figure are routing nodes, wherein 12 primary routing nodes (namely the first type of routing nodes) are arranged, each primary routing node is connected with 4 ports downwards (namely the target number is 4), two upward links are connected with one secondary routing node, and the two upward links are connected with the other primary routing node under the same secondary routing node through two connecting lines; 6 secondary routing nodes (namely the second type of routing nodes) are arranged, and each secondary routing node is downwards connected with two primary routing nodes; three level routing nodes (i.e., the third type of routing nodes described above) are 4, connecting down 6 level routing nodes.
It should be noted that, the number of the third type of routes in the target network is determined by the number of data transmission channels of each second type of routing node and the first type of routing node. The number of the third type of routing in the target network is greater than or equal to the number of data transmission channels of each of the second type of routing nodes and the first type of routing nodes.
Step S604: judging whether the target data packet needs to be forwarded to a routing node in the target network or not under the condition that the forwarding identifier is not carried in the target data packet; under the condition that the target data packet is judged to need to be forwarded to a routing node in the target network, determining a forwarding routing node and a corresponding forwarding identifier; setting the forwarding identifier in the target data packet, and forwarding the target data packet to the forwarding routing node according to the forwarding identifier;
it should be noted that, if the target data packet received by the first routing node does not carry the forwarding identifier, the first routing node is described as the first type node, and the target data packet is a data packet obtained through a port connected with the first routing node.
Step S606: and forwarding the target data packet according to the node type of the first routing node, the node type of a second routing node and the forwarding identifier under the condition that the forwarding identifier is carried in the target data packet, wherein the second routing node is a node which sends the target data packet to the first routing node in the target network.
The step is that a forwarding identifier is set in the data packet, and then a routing path for forwarding the data packet by a routing node is limited, so that the problem that the message forwarding is easy to produce deadlock by using a self-adaptive routing algorithm under the condition that a ring topology structure exists in a network based on routing is solved, and the technical effect of avoiding the deadlock phenomenon is achieved.
In an exemplary embodiment, in the step S604, determining whether the destination packet needs to be forwarded to the routing node in the destination network may be implemented by the following steps S11-S13:
step S11: acquiring a source port number of a source port and a target port number of a target port from the target data packet, wherein the target data packet is a data packet acquired from the source port by the first routing node, and the target data packet is to be forwarded to the target port;
Step S12: judging whether the first type of routing nodes corresponding to the source port and the target port in the target network are the same according to the source port number and the target port number;
it should be noted that if the source port and the destination port are the same in the corresponding first type of routing node in the destination network, it is explained that the source port and the destination port are two ports under one first type of routing node.
In an exemplary embodiment, the above step S12 may be implemented by the following steps S121 to S122:
step S121: dividing the target port number by a first threshold value to obtain a first result; and dividing the source port number by the first threshold to obtain a second result, wherein the first threshold is equal to the target number;
note that, the ports and the routing nodes in the target network are numbered in advance in sequence, and the specific numbering mode is shown in fig. 8.
Step S122: determining that the corresponding first type routing nodes of the source port and the target port in the target network are the same under the condition that the whole digits of the first result and the second result are the same; determining that the corresponding first type of routing nodes of the source port and the target port in the target network are different under the condition that the integral digits of the first result and the second result are different;
For example, as shown in fig. 8, assuming that the source port number is 7, the destination port number is 8, and the first threshold is 4, the first result is calculated to be 1.75, and the second result is calculated to be 2, which indicates that the source port and the destination port are not located under the same routing node of the first type.
In an exemplary embodiment, in the case where the target number is equal to 4, as shown in fig. 8, each first type of routing node corresponds to 4 routing nodes, and the total number of ports in the target network is equal to or less than 64, that is, each port number in the target network may be represented by a 6-bit binary number. The source port number and the target port number can be xored to obtain an exclusive-or result I; if the upper three bits of I are not 000, it means that the source port and the destination port are not at the same second level routing node, and then the source port and the destination port are necessarily not at the same first level routing node, if the upper three bits of I are not 000, it looks at the upper four bits of I, if the upper four bits of I are 0001, it means that the port and the destination port are not under the same first level routing node, if the upper four bits of I are 0000, it means that the port and the destination port are under the same first level routing node.
Step S13: and under the condition that the source port and the target port are different in the corresponding routing nodes of the first type in the target network, judging that the target data packet needs to be forwarded to the routing nodes in the target network.
In an exemplary embodiment, when the source port and the destination port are the same as the corresponding routing nodes of the first type in the destination network, it is determined that the destination data packet does not need to be forwarded to the routing nodes in the destination network; forwarding the target data packet to the target port through the first routing node.
That is, the source port for obtaining the target data packet and the target port for forwarding the target data packet are not located under the first routing node, so that the first routing node does not need to forward the target data packet to other routing nodes in the target network, and can directly forward the target data packet to the target port.
In an exemplary embodiment, in the step S604 described above, the forwarding routing node and the corresponding forwarding identifier may be determined by the following steps S21-S23:
step S21: judging whether the second type of routing nodes corresponding to the source port and the target port in the target network are the same according to the source port number and the target port number;
it should be noted that if the source port and the destination port are the same in the corresponding second type of routing node in the destination network, it is explained that the source port and the destination port are two ports under the first type of routing node under one second type of routing node.
In an exemplary embodiment, the above step S21 may be implemented by the following steps S211 to S212:
step S211: dividing the target port number by a second threshold value to obtain a third result; and dividing the source port number by the second threshold to obtain a fourth result, wherein the second threshold is equal to twice the target number;
step S212: determining that the corresponding second type routing nodes of the source port and the target port in the target network are the same under the condition that the third result and the fourth result are the same in integer digits; and under the condition that the third result is different from the fourth result in integer digits, determining that the corresponding second type of routing nodes of the source port and the target port in the target network are different.
For example, as shown in fig. 8, assuming that the source port number is 16, the destination port number is 23, and the first threshold is 8, the third result is calculated to be 2, and the second result is 2875, which indicates that the source port and the destination port are under the same routing node of the second type.
In an exemplary embodiment, in the case where the target number is equal to 4, as shown in fig. 8, each first type of routing node corresponds to 4 routing nodes, and the total number of ports in the target network is equal to or less than 64, that is, each port number in the target network may be represented by a 6-bit binary number. The source port number and the destination port number may be xored to obtain an exclusive-or result I. If the upper three bits of I are not 000, it means that the source port and the destination port are not at the same secondary routing node, and if the upper three bits of I are not 000, it means that the source port and the destination port are under the same secondary routing node.
Step S22: determining whether a data transmission channel between the first routing node and a third routing node is occupied or not under the condition that the source port and the target port are different in the corresponding routing nodes of the second type in the target network, wherein the third routing node is the routing node of the second type which is directly connected with the first routing node in the target network;
step S23: and determining a forwarding routing node and a corresponding forwarding identifier according to the occupation condition of the data transmission channel between the first routing node and the third routing node.
It should be noted that, when the source port and the destination port are different in the second type of routing nodes corresponding to the destination network, it is described that the first routing node needs to forward the destination data packet to the second type of routing node connected to the first routing node, but if the data transmission channels between the first routing node and the third routing node are occupied, the destination data packet cannot be directly sent to the third routing node, and then the forwarding routing node and the corresponding forwarding identifier need to be determined according to the occupation condition of the data transmission channel between the first routing node and the third routing node.
In an exemplary embodiment, the above step S23 may be implemented by the following steps S231 to S233:
step S231: under the condition that a data transmission channel is unoccupied between the first routing node and the third routing node, determining that the forwarding routing node is the third routing node, and determining a corresponding forwarding identifier as a first identifier, wherein the first identifier is used for indicating the forwarding of the target data packet based on a shortest path;
that is, in the case that the data transmission channel is unoccupied between the first routing node and the third routing node, the target data packet may be forwarded based on the shortest path, that is, the forwarding routing node is the third routing node, and the forwarding identifier is determined to be the first identifier (e.g., 00).
As an alternative example, in the case where both data transmission channels between the first routing node and the third routing node are unoccupied, one data transmission channel may be randomly selected from the two data transmission channels to transmit.
Step S232: under the condition that data transmission channels between the first routing node and the third routing node are occupied, determining the forwarding routing node as a fourth routing node, wherein the fourth routing node is the first type routing node connected with the first routing node in the target network;
It should be noted that, under the condition that the data transmission channels between the first routing node and the third routing node are occupied, it is not possible to directly forward the target data packet to the third routing node, and then the target data packet needs to be forwarded to the third routing node through the fourth routing node between the first routing node and the third routing node, that is, the forwarding routing node is determined to be the fourth routing node.
Step S233: and under the condition that the target data transmission channel between the first routing node and the fourth routing node is used for transmitting the data packet, determining a corresponding forwarding identifier as a second identifier corresponding to the target data transmission channel, wherein the second identifier is used for indicating that the target data packet is not forwarded based on a shortest path and the target data transmission channel is required to be used for forwarding.
It should be noted that, the numbers of the two data transmission channels between the first routing node and the fourth routing node are different (i.e., the types are different), if the data transmission channel with the number "+" is used for transmitting the target data packet, the second identifier is a first sub-identifier (e.g., 11) corresponding to the "+", and if the data transmission channel with the number "-" is used for transmitting the target data packet, the second identifier is a second sub-identifier (e.g., 10) corresponding to the "-". The target data transmission channel is a data transmission channel numbered "+" or a data transmission channel numbered "-".
In an exemplary embodiment, following step S21 described above, there are also the following steps S24-S25:
step S24: determining whether a data transmission channel between the first routing node and a fourth routing node is occupied or not under the condition that the source port and the target port are the same in a corresponding routing node of a second type in the target network, wherein the fourth routing node is the routing node of the first type connected with the first routing node in the target network;
step S25: and determining a forwarding routing node and a corresponding forwarding identifier according to the occupation condition of the data transmission channel between the first routing node and the fourth routing node.
It should be noted that if the source port and the destination port are the same in the corresponding second type of routing node in the destination network and the corresponding first type of routing node is different, it is indicated that the destination port is located under the fourth routing node, and the first routing node needs to forward the destination data packet to the fourth routing node, but if the data transmission channels between the first routing node and the fourth routing node are occupied, the destination data packet cannot be directly sent to the fourth routing node, and then the forwarding routing node and the corresponding forwarding identifier need to be determined according to the occupation condition of the data transmission channel between the first routing node and the fourth routing node.
It should be noted that, the steps S22 to S23 and the steps S24 to S25 are not performed in sequence, and are performed under different conditions.
In an exemplary embodiment, the above step S25 may be implemented by the following steps S251 to S253:
step S251: under the condition that a data transmission channel is unoccupied between the first routing node and the fourth routing node, determining that the forwarding routing node is the fourth routing node, and determining a corresponding forwarding identifier as a first identifier, wherein the first identifier is used for indicating the forwarding of the target data packet based on a shortest path;
that is, in the case that the data transmission channel is unoccupied between the first routing node and the fourth routing node, the forwarding of the target data packet may be performed based on the shortest path, that is, the forwarding routing node is the fourth routing node, and the forwarding identifier is determined to be the first identifier (e.g., 00).
Step S252: under the condition that data transmission channels between the first routing node and the fourth routing node are occupied, determining the forwarding routing node as a third routing node, wherein the third routing node is the second type routing node connected with the first routing node in the target network;
It should be noted that, under the condition that the data transmission channels between the first routing node and the fourth routing node are occupied, it is described that the target data packet cannot be directly forwarded to the fourth routing node, and then the target data packet needs to be forwarded to the fourth routing node through the third routing node between the first routing node and the fourth routing node, that is, the forwarding routing node is determined to be the third routing node.
Step S253: and under the condition that the target data transmission channel between the first routing node and the third routing node is used for transmitting the data packet, determining a corresponding forwarding identifier as a second identifier corresponding to the target data transmission channel, wherein the second identifier is used for indicating that the target data packet is not forwarded based on a shortest path and the target data transmission channel is required to be used for forwarding.
It should be noted that, the numbers of the two data transmission channels between the first routing node and the third routing node are different, if the data transmission channel with the number "+" is used for transmitting the target data packet, the second identifier is a first sub-identifier (for example, 11) corresponding to the "+", and if the data transmission channel with the number "-" is used for transmitting the target data packet, the second identifier is a second sub-identifier (for example, 10) corresponding to the "-".
In an exemplary embodiment, in the step S604, forwarding the target data packet to the forwarding routing node according to the forwarding identifier includes: when the forwarding identifier indicates a data transmission channel, forwarding the target data packet to the forwarding routing node by using the data transmission channel indicated by the forwarding identifier; and forwarding the target data packet to the forwarding routing node by using an unoccupied data transmission channel between the first routing node and the forwarding routing node under the condition that the forwarding identifier does not indicate the data transmission channel.
It should be noted that the forwarding identifier includes the first identifier and the second identifier, where the first identifier does not indicate a data transmission channel, and the second identifier indicates a data transmission channel.
For a better understanding of the above step S204, the following is illustrated with reference to fig. 8: assuming that the source port in the target data packet is port10, the binary number is 001010, the target port is port7, the binary number is 000111, after the first routing node receives the routing request, it is determined that the source port and the target port are not under the same primary routing node and are not under the same secondary routing node, the shortest path is preferentially selected to be directly forwarded to the secondary routing node, if both ports of the shortest path are occupied, the shortest path can be selectively forwarded to the other connected primary routing node, if a "-" path is walked, the forwarding identifier is "10", and if a "+" path is walked, the forwarding identifier is "11".
In an exemplary embodiment, the step S606 includes the following steps S31-S32:
step S31: forwarding the target data packet to the target port according to the target port number of the target port carried in the target data packet when the node type of the first routing node is the first type, the node type of the second routing node is the second type, and the forwarding identifier is the first identifier; the first identifier is used for indicating the forwarding of the target data packet based on a shortest path;
step S32: when the node type of the first routing node is the first type, the node type of the second routing node is the second type, and the forwarding identifier is the second identifier, modifying the forwarding identifier in the target data packet to the first identifier, and forwarding the target data packet to a fourth routing node through a data transmission channel different from a target data transmission channel in two data transmission channels between the first routing node and the fourth routing node; the fourth routing node is the first type of routing node connected with the first routing node in the target network; the second identifier is used for indicating that the target data packet is not forwarded based on the shortest path and the target data transmission channel is required to be used for forwarding.
That is, in this embodiment, if the primary routing node receives the target data packet from the secondary routing node, it needs to check the forwarding identifier in the target data packet, and if the forwarding identifier is the first identifier (e.g. 00), the primary routing node that receives the target data packet directly forwards the target data packet downward to the target port according to the target port number of the target port carried in the target data packet; if the forwarding identifier is the second identifier, the description indicates that the currently received target data packet should be sent to another connected first-level routing node, and then the forwarding identifier in the target data needs to be modified into the first identifier, and the modified target data packet is forwarded to the fourth routing node through a data transmission channel different from the target data transmission channel indicated by the second identifier in two data transmission channels between the first routing node and the fourth routing node.
For example, in the case of the second identifier being "10", it indicates that the last step is not the shortest path and the path is the "-" path, and thus, only the "+" path is currently taken to forward to another connected primary routing node; in the case of the second flag being "11", this indicates that the last step is not the shortest path and that a "+" path is taken, and only the "-" path can be currently taken for forwarding to another connected primary routing node.
In an exemplary embodiment, the step S606 includes the following steps S41-S42:
step S41: forwarding the target data packet to the target port according to the target port number of the target port carried in the target data packet when the node type of the first routing node is the first type, the node type of the second routing node is the first type, and the forwarding identifier is the first identifier;
step S42: when the node type of the first routing node is the first type, the node type of the second routing node is the first type, and the forwarding identifier is the second identifier, modifying the forwarding identifier in the target data packet to the first identifier, and forwarding the target data packet to a third routing node through a data transmission channel different from a target data transmission channel in two data transmission channels between the first routing node and the third routing node;
it should be noted that, the third routing node is the second type of routing node connected to the first routing node in the target network; the first identifier is used for indicating that the target data packet is forwarded based on a shortest path, and the second identifier is used for indicating that the target data packet is not forwarded based on the shortest path and is required to be forwarded by using the target data transmission channel.
That is, in this embodiment, if the primary routing node receives the target data packet from the connected primary routing node, it needs to check the forwarding identifier in the target data packet, and if the forwarding identifier is the first identifier (e.g. 00), the primary routing node that receives the target data packet forwards the target data packet directly downward to the target port according to the target port number of the target port carried in the target data packet. If the forwarding identifier is the second identifier, the description indicates that the currently received target data packet should be sent to the connected second-level routing node, and then the forwarding identifier in the target data needs to be modified into the first identifier, and the modified target data packet is forwarded to the third routing node through a data transmission channel different from the target data transmission channel indicated by the second identifier in two data transmission channels between the first routing node and the third routing node.
For example, in the case of the second identifier "10", it indicates that the last step is not the shortest path and the path is the "-" path, and thus, only the "+" path is currently taken to forward to another connected secondary routing node; in the case of the second flag "11", this indicates that the last step is not the shortest path and that a "+" path is taken, and only a "-" path can currently be taken for forwarding to the connected secondary routing node.
In an exemplary embodiment, the step S606 further includes the following steps S51-S52:
step S51: forwarding the target data packet to a fifth routing node under the condition that the node type of the first routing node is the second type, the node type of the second routing node is the first type, and the forwarding identifier is the first identifier, wherein the fifth routing node is a routing node of a third type connected with the first routing node in the target network;
step S52: when the node type of the first routing node is the second type, the node type of the second routing node is the first type, and the forwarding identifier is the second identifier, modifying the forwarding identifier in the target data packet to the first identifier, and forwarding the target data packet to a sixth routing node through a data transmission channel different from a target data transmission channel in two data transmission channels between the first routing node and the sixth routing node;
it should be noted that, the sixth routing node is a routing node different from the second routing node in two first types of routing nodes connected to the first routing node in the target network, the first identifier is used for indicating that the target data packet is forwarded based on a shortest path, and the second identifier is used for indicating that the target data packet is not forwarded based on the shortest path, and the target data transmission channel is required to be used for forwarding.
That is, in this embodiment, if the secondary routing node receives the target packet from the connected primary routing node, it needs to check the forwarding identifier in the target packet, and if the forwarding identifier is the first identifier (e.g. 00), it forwards the target packet directly to the connected tertiary routing node. If the forwarding identifier is the second identifier, it indicates that the target data packet should be sent to another first-level routing node, and then the forwarding identifier in the target data needs to be modified into the first identifier, and the modified target data packet is forwarded to the sixth routing node through a data transmission channel different from the target data transmission channel indicated by the second identifier in two data transmission channels between the first routing node and the sixth routing node.
For example, in the case of the second identifier being "10", it indicates that the last step is not the shortest path and the path is the "-" path, and thus, only the "+" path is currently taken to forward to another connected primary routing node; in the case of the second flag being "11", this indicates that the last step is not the shortest path and that a "+" path is taken, and only the "-" path can be currently taken for forwarding to another connected primary routing node.
In an exemplary embodiment, before forwarding the target data packet to the fifth routing node, the method further includes: and determining a fifth routing node with unoccupied data transmission channels from a plurality of routing nodes of a third type connected with the first routing node in the target network.
In an exemplary embodiment, the step S606 further includes the following steps S61-S62:
step S61: determining a seventh routing node according to a target port number of a target port carried in the target data packet when the node type of the first routing node is the second type, the node type of the second routing node is the third type, and the forwarding identifier is a first identifier, wherein the seventh routing node is a routing node of a first type corresponding to the target port in the target network, and the first identifier is used for indicating that the target data packet is forwarded based on a shortest path;
step S62: forwarding the target data packet to the seventh routing node.
It should be noted that, if the second-level routing node receives the target data packet from the third-level routing node, the forwarding identifier in the target data packet must be the first identifier, and then the second-level routing node needs to determine, according to the target port number of the target port in the target data packet, which one of the two first-level routing nodes that the target port corresponds to the second-level routing node and is connected to itself, and forward the target data packet to the first-level routing node.
In an exemplary embodiment, determining the seventh routing node according to the destination port number of the destination port carried in the destination data packet may be implemented by the following steps S611-S613:
step S611: dividing the target port number by a first threshold to obtain a fifth result, wherein the first threshold is equal to the target number;
step S612: determining a first preset routing node of two first types of routing nodes corresponding to the first routing node in the target network as the seventh routing node under the condition that the integer digits of the fifth result are even;
step S613: and under the condition that the integer digits of the fifth result are odd numbers, determining a second preset routing node as the seventh routing node in two first type routing nodes corresponding to the first routing node in the target network.
In an exemplary embodiment, in the case of the destination network as shown in fig. 8, the most significant bit of the lower three bits of the destination port number may be determined, if 0, to indicate that the destination port is on the left primary routing node connected to the secondary routing node, and if 1, to indicate that the destination port is on the right primary routing node connected to the secondary routing node.
In an exemplary embodiment, the above step S62 may be implemented by the following steps S621 to S623:
step S621: determining whether a data transmission channel between the first routing node and the seventh routing node is occupied;
step S622: directly forwarding the target data packet to the seventh routing node under the condition that a data transmission channel is unoccupied between the first routing node and the seventh routing node;
step S623: when the data transmission channels between the first routing node and the seventh routing node are occupied and the data packet transmission is determined to be carried out by using a target data transmission channel between the first routing node and an eighth routing node, modifying a forwarding identifier in the target data packet to a second identifier corresponding to the target data transmission channel, and forwarding the target data packet to the eighth routing node so as to forward the target data packet to the seventh routing node through the eighth routing node;
the eighth routing node is a routing node different from the seventh routing node among two routing nodes of the first type connected with the first routing node in the target network, and the second identifier is used for indicating that the target data packet is not forwarded based on a shortest path and is required to be forwarded by using the target data transmission channel.
That is, if there is a data transmission channel between the first routing node and the seventh routing node that is not occupied, directly forwarding the target data packet to the seventh routing node, if there is a data transmission channel between the first routing node and the seventh routing node that is occupied, determining a target data transmission channel from the data transmission channels between the first routing node and the eighth routing node, and modifying a forwarding identifier in the target data packet to a second identifier corresponding to the target data transmission channel, and forwarding the target data packet to the eighth routing node to forward the target data packet to the seventh routing node through the eighth routing node;
for example, if the destination port is on the left primary routing node connected to the secondary routing node, it is routed to the left primary routing node preferentially through the shortest path, if the ports of the shortest path connecting the left primary routing node are all occupied, it is forwarded to the right primary routing node, if the path is the "-" path, it is forwarded with the identification "10", if the path is the "+" path, it is forwarded with the identification "11".
In an exemplary embodiment, the step S606 further includes the following steps S71-S72:
Step S71: determining a ninth routing node according to a target port number of a target port carried in the target data packet when the node type of the first routing node is the third type, the node type of the second routing node is the second type, and the forwarding identifier is a first identifier, wherein the ninth routing node is a routing node of the second type corresponding to the target port in the target network, and the first identifier is used for indicating that the target data packet is forwarded based on a shortest path;
step S72: forwarding the target data packet to the ninth routing node.
That is, in this embodiment, when the third-level routing node receives the target data packet sent by the second-level routing node, the second-level routing node corresponding to the target port needs to forward the target data packet to the second-level routing node according to the target port number of the target port carried in the target data packet.
In an exemplary embodiment, the above determination of the ninth routing node according to the destination port number of the destination port carried in the destination data packet may be implemented by the following steps S711 to S712:
Step S711: dividing the target port number by a second threshold to obtain a sixth result, wherein the second threshold is equal to twice the target number;
step S712: and determining the routing node numbered as the integer digit of the sixth result in the target network as the ninth routing node.
In an exemplary embodiment, in the case that the destination network is as shown in fig. 8, the upper three bits of the destination port may represent the number of the secondary routing node corresponding to the destination port, for example, the destination port number is 101000, and the upper three bits are 101, that is, the number of the secondary routing node corresponding to the destination port is 5.
For better understanding, the following details of the target network in the embodiments of the present application are described below:
aiming at the defects of the system on chip in time delay, clock synchronization, expandability, energy consumption, reusability and the like, a new system on chip structure of 'network on chip' is proposed at the end of century, the system on chip well overcomes various limitations brought by a bus structure, fully references related network technology in the existing computer network, and introduces the related network technology into the system on chip for development and utilization, and has good development prospect. Its advantages are:
(1) The network on chip uses the network structure in the computer network as a reference, the whole network is connected by a plurality of point-to-point lines, interference can not be generated between the network on chip and the network on chip, and the communication requirements of a plurality of users can be met.
(2) Unlike a system on chip, a network on chip adopts a global asynchronous and local synchronous mode to solve the clock synchronization problem. The local network works under the own clock frequency, so that the global synchronization problem of the clock is avoided, the clock offset problem is solved, and the power consumption of the network is greatly reduced.
(3) The utilization of bandwidth by the network on chip is relatively high. Because the network on chip supports multipoint parallel transmission, the data transmission of various lines can be completed at the same time, and the communication efficiency is high. And the addressing of the network on chip is completed in the local network, the influence of the expansion of the network scale on the addressing is smaller, so that the number of bits occupied by the addressing in the bandwidth is not increased, and the bandwidth is not a bottleneck of the expansion of the network scale.
(4) The bus structure uses the central decision unit to uniformly manage the use right of the line, and the network-on-chip uses a random arbitration mechanism, so that the problem of larger time delay is avoided.
(5) The network on chip adopts the core idea, and each core is expanded along with the network scale, so that the judgment time delay is larger and larger, and the performance of the system is greatly influenced. The network on chip adopts a local decision strategy, and an independent functional unit in the line is completed in a distributed manner, so that the network on chip has good reusability. Meanwhile, the routing equipment in the network can be used in various environments, and the reusability is high. Because of the good reusability of the network components, the network-on-chip has the characteristic of high cohesion, has high expandability and portability, greatly shortens the development time of the system, improves the development efficiency, and is particularly important in the current ultra-large scale network design.
The Clos network is a network topology most commonly used by the network on chip, the initial Cols network is a classical multistage interconnection network, and is proposed by Charles Clos in 1953, which is evolved based on the Benes network, and the network is widely adopted in communication networks and multiprocessor computer systems, so that the network is widely valued, and since the proposal of Clos, the topology structure, connection characteristics and control algorithm of the network are deeply studied, and a lot of results are achieved.
The modules among the stages of the Clos network are connected by only one, but a plurality of paths are selectable among any input/output ports, so that the Clos switching network has the characteristic of multipath, and a plurality of equivalent paths can support the load balance of the service while providing redundancy; the module scale and structure of each stage of the Clos switching network are the same, and the Clos switching network has the characteristic of modularization and good expandability. However, when the scale of the network increases, the number of routing nodes and the number of connection lines of the Clos switching network greatly increase, as shown in fig. 7, fig. 7 illustrates a bidirectional two-stage Clos network, where each link in the figure can bidirectionally transmit data, that is, is full duplex, and the blocks in the figure are source nodes (port nodes), 48 in total, the circles are routing nodes, the number of the first-stage routing nodes is 6, and the number of the second-stage routing nodes is 8. 8 port nodes are hung on the primary routing node. The source node is responsible for sending and collecting data packets, and can mutually send the data packets; the routing node is responsible for forwarding the data packet. The 6 primary routing nodes in fig. 7 each have 16 outgoing links and 16 outgoing links, corresponding to 16 input ports and 16 output ports; this topology is a great challenge for the layout and wiring of the back end, and the hardware implementation logic of 16 inputs and 16 outputs is complex, resulting in an excessive routing node area and further increasing the difficulty of the layout and wiring.
However, in real world, there are typically many different width ports sharing a set of PHYs, 1 port with width X16, 1 port with width X8, 2 ports with width X4, and 4 ports with width X2 share 4 PHYs of X4, that is, 8 ports with different widths share 4 PHYs of X4, as shown in table 1 below.
TABLE 1
A port of width X16 can be used as a port of X16, X8, X4, X2, a port of width X8 can be used as a port of X8, X4, X2, and a port of width X4 can be used as a port of X4, X2; a port of width X2 can only be used as a port of X2.
When a port with width X16 is used as a port of X16, all PHYs are occupied, and other ports with width are not available, i.e. only one port with width X16 from 8 ports is used as a port of X16, as shown in table 2:
TABLE 2
A port of width X16 can be used as a port of X8, but this would occupy 2 PHYs of X4, and a port of width X8 would occupy the remaining 2 PHYs of X4 when used as a port of X8, as shown in table 3:
TABLE 3 Table 3
In addition, there are other uses, as listed in tables 4, 5 below:
TABLE 4 Table 4
TABLE 5
When 8 ports are all in use, as shown in Table 6 below, all width ports are in use as X2 ports:
TABLE 6
In summary, for the use cases of 8 ports sharing the same PHY, only one port with width X16 is used as the port of X16 at the least, and all 8 ports with different widths are used as the port of X2 at the most. Although the number of ports that share the same set of PHYs in actual use is not certain, the total bandwidth is consistent, and in order to meet the bandwidth of X16 ports, any and every connection in the network is designed to be according to the bandwidth of X16 ports, so the number of connections can be optimized. In the real project, when the conditions of the table 2 and the table 3 are met, the mutual visit requirement of the port ports is relatively large, and the mutual visit of the port ports with the rest widths is very rare. But the connections in the clos network topology of fig. 7 are designed in the case where all ports are used as ports of X2, which results in most of the connections being redundant. Therefore, the application provides an improved close network based on the grouping (the network topology diagram is shown in fig. 8), the connection topology of 8 ports sharing the same group of PHYs is optimized according to the actual use condition, the number of the connection lines of the routing nodes of the network after optimization is obviously reduced, and the back-end layout and wiring are facilitated; and a routing algorithm for the network is provided, the algorithm is simple, and the hardware implementation logic is simple.
As shown in fig. 8, which is the location of the improved CLOS network based on the packet and the ports with various widths, compared with fig. 7, it can be seen that, although the topology structure after optimization is increased by 12 routing nodes at the bottom layer, the number of the input and output wires of all the routing nodes is significantly reduced, which is beneficial to the back-end layout and wiring; and although the number of the connecting lines from the primary routing node to the secondary routing node is reduced, the most-used scenes of the table 2, the table 3, the table 4 and the table 5 can be met, and the change is more in line with the actual use scene of the project.
It will be apparent that the embodiments described above are merely some, but not all, embodiments of the invention. For better understanding of the above method, the following description will explain the above process with reference to the examples, but is not intended to limit the technical solution of the embodiments of the present invention, specifically:
it should be noted that the reason for the deadlock is because there is a "ring" in the topology and no limitation is imposed on the routing path. However, for fig. 8, two data transmission paths are provided between the secondary routing node and the corresponding two primary routing nodes, and each routing node may be denoted as a "+" path and a "-" path by using the same two paths (i.e., two data transmission paths) of the start node and the end node, as shown in fig. 9.
Convention:
1. if the route is the shortest route, both the "+" route and the "-" route can be taken;
2. if not the shortest route, the signs of the two route paths cannot be the same, namely, one route path is a "+" path and one route path is a "-" path; examples: the primary routing node 0 routes to the primary routing node 1, with the shortest paths shown in fig. 10 and the non-shortest paths shown in fig. 11.
3. The method comprises the steps that a two-bit rotary flag bit (namely a forwarding identifier in the embodiment) is added in a routing path, wherein '0_' represents that a shortest path is always taken, '10' is not the shortest path in the last step and is taken as a 'path', and only a 'plus' path can be taken at present; the last step of "11" is not the shortest path and takes a "+" path, only a "-" path can be taken currently;
4. when both paths are routed, the swing flag is marked as "00".
For the shortest path, no deadlock will occur, so it is not within the scope of the discussion, which is mainly how to avoid deadlock under the non-shortest path: for the example of a deadlock occurring clockwise in fig. 3, if the scheme of the present invention is used, the possible routing is as shown in fig. 12, and no "closed loop" is generated, and therefore no deadlock occurs.
For a better understanding, the adaptive routing algorithm for avoiding deadlock for the improved CLOS network of the present application is described in detail below in conjunction with fig. 8:
the source node (i.e., source port) of the packet is denoted as S, and the destination node (i.e., destination port) of the packet is denoted as D.
1. For a primary routing node:
(1) Receiving a routing request from the following port:
and carrying out exclusive or on the high four bits of S and D to obtain I, if the high three bits of I are not 000, indicating that S and D are not in the same secondary routing node, preferably selecting the shortest path, namely directly forwarding the shortest path upwards to the secondary routing node, if both ports of the shortest path are occupied, selectively forwarding the shortest path to the other connected primary routing node, if a path is walked, marking the gyration zone bit as 10, and if a path is walked, marking the gyration zone bit as 11.
If the upper three bits of I are 000, the upper four bits of I are checked under the same two-level routing node, if the upper four bits of I are 0001, the upper three bits of I are preferably forwarded to another connected one-level routing node through the shortest path if the upper four bits of I are 0001, if the upper three bits of I are on different one-level routing nodes under the same two-level routing node, if the ports of two shortest paths connecting the other connected one-level routing node are occupied, the upper four bits of I can be forwarded to the two-level routing node, if a path is taken, "-" is followed, the turn flag bit is marked as "10", and if a path is taken "+", the turn flag bit is marked as "11"; if the upper four bits of I are 0000, it means that S and D are two ports linked on the same level one routing node, and forward downwards according to the output port corresponding downwards to the lower two bits of D.
Example 1: s is port10, binary number is 001010, D is port7, binary number is 000111, after the first-level routing node 1 receives the routing request, the higher three bits of S and D are exclusive-or, if the result is 001, it means that S and D are not under the same second-level routing node, the shortest path is preferentially selected and directly forwarded to the second-level routing node, if both ports of the shortest path are occupied, the shortest path can be selectively forwarded to another connected first-level routing node, if a "-" path is walked, the turning flag bit is marked as "10", and if a "+" path is walked, the turning flag bit is marked as "11";
(2) Receiving a routing request from a secondary routing node:
checking the rotation flag bit, and forwarding downwards from the corresponding output port according to the lower two bits of D if the rotation flag bit is 0_; if the rotation flag bit is ' 10 ', the former step is not the shortest path and the former step is the ' path ', and only the ' path is forwarded to another connected first-level routing node; if the rotation flag bit is 11, the last step is not the shortest path and the path is the "+" path, and only the "-" path can be currently walked to be forwarded to the other connected first-level routing node;
(3) Receiving a routing request from a connected primary routing node port:
checking the rotation flag bit, and forwarding downwards from the corresponding output port according to the lower two bits of D if the rotation flag bit is 0_; if the turn flag bit is '10', the former step is not the shortest path and the former step is the 'path', and only the 'plus' path can be currently walked to forward to the connected secondary routing node; if the turn flag bit is "11", it indicates that the last step is not the shortest path and the "+" path is taken, and only the "-" path can be taken currently to forward to the connected secondary routing node.
2. For the secondary routing node:
(1) Receiving a routing request from a primary routing node:
checking the rotation zone bit, and if the rotation zone bit is 0_, forwarding the rotation zone bit to the three-level routing nodes upwards; if the turn flag bit is ' 10 ', the former step is not the shortest path and the former step is the ' path ', and only the ' path is forwarded to another connected first-level routing node; if the turn flag bit is 11, the last step is not the shortest path and the path is the "+" path, and only the "-" path can be currently walked to forward to the connected other one-level routing node;
(2) Receiving a routing request from a tertiary routing node:
checking the highest bit of the D low three bits; if the port of the shortest path connecting the left primary routing node is occupied, the port is transferred to the right primary routing node, if a path is a "-" path, the turn flag bit is marked as "10", and if a path is a "+" path, the turn flag bit is marked as "11"; if the port of the first-level routing node is occupied, the port is transferred to the left-level routing node, if a path is taken, the turn flag bit is marked as '10', and if a path is taken, the turn flag bit is marked as '11'.
3. For three-level routing nodes:
after receiving the routing request from the lower port, the high three bits of D represent the output port corresponding to D; for example, d=101000, the upper three bits are 101, i.e., the output port corresponding to D is port No. 5.
It should be noted that, the self-adaptive routing algorithm for avoiding deadlock, which is provided by the application, is suitable for improving a clos network, so that the diversity of paths is maintained to the greatest extent and deadlock can be avoided.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), comprising several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method described in the embodiments of the present application.
The embodiment also provides a forwarding device for a data packet, which is used for implementing the foregoing embodiments and preferred embodiments, and is not described in detail. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
Figure 13 is a block diagram of a forwarding device for data packets according to an embodiment of the present application,
a determining module 132, configured to determine, when a first routing node in a target network obtains a target data packet, whether the target data packet carries a forwarding identifier, where the forwarding identifier is used to indicate a forwarding manner of the target data packet;
a first forwarding module 134, configured to determine, if the target data packet does not carry the forwarding identifier, whether the target data packet needs to be forwarded to a routing node in the target network; under the condition that the target data packet is judged to need to be forwarded to a routing node in the target network; setting the forwarding identifier in the target data packet, determining a forwarding routing node and a corresponding forwarding identifier, and forwarding the target data packet to the forwarding routing node according to the forwarding identifier;
and a second forwarding module 136, configured to forward, when the target data packet carries the forwarding identifier, the target data packet according to a node type of the first routing node, a node type of a second routing node, and the forwarding identifier, where the second routing node is a node in the target network that sends the target data packet to the first routing node.
According to the device, the forwarding identifier is arranged in the data packet, and the routing path for forwarding the data packet by the routing node is further limited, so that the problem that the message forwarding is easy to produce deadlock by using the self-adaptive routing algorithm under the condition that a ring topology structure exists in a network based on the routing is solved, and the technical effect of avoiding the deadlock phenomenon is achieved.
In an exemplary embodiment, the target network includes a plurality of routing nodes, the plurality of routing nodes including: a first type of routing node, a second type of routing node, a third type of routing node; each second type of routing node in the target network is connected with two first type of routing nodes, two data transmission channels are arranged between each routing node in the two first types of routing nodes, each routing node in the target network is connected with each routing node in the third type of routing node in the target network, and each routing node in the target network is connected with a target number of ports, and the ports are used for receiving and sending data packets.
In an exemplary embodiment, the first forwarding module 134 is further configured to determine whether the target data packet needs to be forwarded to a routing node in the target network by: acquiring a source port number of a source port and a target port number of a target port from the target data packet, wherein the target data packet is a data packet acquired from the source port by the first routing node, and the target data packet is to be forwarded to the target port; judging whether the first type of routing nodes corresponding to the source port and the target port in the target network are the same according to the source port number and the target port number; and under the condition that the source port and the target port are different in the corresponding routing nodes of the first type in the target network, judging that the target data packet needs to be forwarded to the routing nodes in the target network.
In an exemplary embodiment, the above apparatus further includes: a third forwarding module, configured to determine that, when the source port and the destination port are the same in the routing nodes of the first type corresponding to the destination port in the destination network, the destination data packet does not need to be forwarded to the routing nodes in the destination network; forwarding the target data packet to the target port through the first routing node.
In an exemplary embodiment, the first forwarding module 134 is further configured to determine a forwarding routing node and a corresponding forwarding identifier by: judging whether the second type of routing nodes corresponding to the source port and the target port in the target network are the same according to the source port number and the target port number; determining whether a data transmission channel between the first routing node and a third routing node is occupied or not under the condition that the source port and the target port are different in the corresponding routing nodes of the second type in the target network, wherein the third routing node is the routing node of the second type which is directly connected with the first routing node in the target network; and determining a forwarding routing node and a corresponding forwarding identifier according to the occupation condition of the data transmission channel between the first routing node and the third routing node.
In an exemplary embodiment, the first forwarding module 134 is further configured to determine a forwarding routing node and a corresponding forwarding identifier according to an occupancy of a data transmission channel between the first routing node and a third routing node by: under the condition that a data transmission channel is unoccupied between the first routing node and the third routing node, determining that the forwarding routing node is the third routing node, and determining a corresponding forwarding identifier as a first identifier, wherein the first identifier is used for indicating the forwarding of the target data packet based on a shortest path; under the condition that data transmission channels between the first routing node and the third routing node are occupied, determining the forwarding routing node as a fourth routing node, wherein the fourth routing node is the first type routing node connected with the first routing node in the target network; and under the condition that the target data transmission channel between the first routing node and the fourth routing node is used for transmitting the data packet, determining a corresponding forwarding identifier as a second identifier corresponding to the target data transmission channel, wherein the second identifier is used for indicating that the target data packet is not forwarded based on a shortest path and the target data transmission channel is required to be used for forwarding.
In an exemplary embodiment, the first forwarding module 134 is further configured to determine, if the source port and the destination port are the same as corresponding second type of routing nodes in the destination network, whether a data transmission channel between the first routing node and a fourth routing node is occupied, where the fourth routing node is the first type of routing node connected to the first routing node in the destination network; and determining a forwarding routing node and a corresponding forwarding identifier according to the occupation condition of the data transmission channel between the first routing node and the fourth routing node.
In an exemplary embodiment, the first forwarding module 134 is further configured to determine a forwarding routing node and a corresponding forwarding identifier according to an occupancy of a data transmission channel between the first routing node and a fourth routing node by: under the condition that a data transmission channel is unoccupied between the first routing node and the fourth routing node, determining that the forwarding routing node is the fourth routing node, and determining a corresponding forwarding identifier as a first identifier, wherein the first identifier is used for indicating the forwarding of the target data packet based on a shortest path; under the condition that data transmission channels between the first routing node and the fourth routing node are occupied, determining the forwarding routing node as a third routing node, wherein the third routing node is the second type routing node connected with the first routing node in the target network; and under the condition that the target data transmission channel between the first routing node and the third routing node is used for transmitting the data packet, determining a corresponding forwarding identifier as a second identifier corresponding to the target data transmission channel, wherein the second identifier is used for indicating that the target data packet is not forwarded based on a shortest path and the target data transmission channel is required to be used for forwarding.
In an exemplary embodiment, the first forwarding module 134 is further configured to determine, according to the source port number and the destination port number, whether the first type of routing nodes corresponding to the source port and the destination port in the destination network are the same by: dividing the target port number by a first threshold value to obtain a first result; dividing the source port number by the first threshold value to obtain a second result; determining that the corresponding first type routing nodes of the source port and the target port in the target network are the same under the condition that the whole digits of the first result and the second result are the same; wherein the first threshold is equal to the target number; and under the condition that the integral digits of the first result and the second result are different, determining that the corresponding first type of routing nodes of the source port and the target port in the target network are different.
In an exemplary embodiment, the first forwarding module 134 is further configured to determine, according to the source port number and the destination port number, whether the second type of routing nodes corresponding to the source port and the destination port in the destination network are the same by: dividing the target port number by a second threshold value to obtain a third result; dividing the source port number by the second threshold value to obtain a fourth result; determining that the corresponding second type routing nodes of the source port and the target port in the target network are the same under the condition that the third result and the fourth result are the same in integer digits; wherein the second threshold is equal to twice the target number; and under the condition that the third result is different from the fourth result in integer digits, determining that the corresponding second type of routing nodes of the source port and the target port in the target network are different.
In an exemplary embodiment, the first forwarding module 134 is further configured to forward the target data packet to the forwarding routing node according to the forwarding identifier by: setting the forwarding identifier in the target data packet; when the forwarding identifier indicates a data transmission channel, forwarding the target data packet to the forwarding routing node by using the data transmission channel indicated by the forwarding identifier; and forwarding the target data packet to the forwarding routing node by using an unoccupied data transmission channel between the first routing node and the forwarding routing node under the condition that the forwarding identifier does not indicate the data transmission channel.
In an exemplary embodiment, the second forwarding module 136 is configured to forward the target data packet according to the node type of the first routing node, the node type of the second routing node, and the forwarding identifier in the following manner: forwarding the target data packet to the target port according to the target port number of the target port carried in the target data packet when the node type of the first routing node is the first type, the node type of the second routing node is the second type, and the forwarding identifier is the first identifier; when the node type of the first routing node is the first type, the node type of the second routing node is the second type, and the forwarding identifier is the second identifier, modifying the forwarding identifier in the target data packet to the first identifier, and forwarding the target data packet to a fourth routing node through a data transmission channel different from a target data transmission channel in two data transmission channels between the first routing node and the fourth routing node; the fourth routing node is the first type of routing node connected with the first routing node in the target network; the first identifier is used for indicating that the target data packet is forwarded based on a shortest path, and the second identifier is used for indicating that the target data packet is not forwarded based on the shortest path and is required to be forwarded by using the target data transmission channel.
In an exemplary embodiment, the second forwarding module 136 is further configured to forward the target data packet according to the node type of the first routing node, the node type of the second routing node, and the forwarding identifier by: forwarding the target data packet to the target port according to the target port number of the target port carried in the target data packet when the node type of the first routing node is the first type, the node type of the second routing node is the first type, and the forwarding identifier is the first identifier; when the node type of the first routing node is the first type, the node type of the second routing node is the first type, and the forwarding identifier is the second identifier, modifying the forwarding identifier in the target data packet to the first identifier, and forwarding the target data packet to a third routing node through a data transmission channel different from a target data transmission channel in two data transmission channels between the first routing node and the third routing node; wherein the third routing node is the second type of routing node connected to the first routing node in the target network; the first identifier is used for indicating that the target data packet is forwarded based on a shortest path, and the second identifier is used for indicating that the target data packet is not forwarded based on the shortest path and is required to be forwarded by using the target data transmission channel.
In an exemplary embodiment, the second forwarding module 136 is further configured to forward the target data packet according to the node type of the first routing node, the node type of the second routing node, and the forwarding identifier by: forwarding the target data packet to a fifth routing node under the condition that the node type of the first routing node is the second type, the node type of the second routing node is the first type, and the forwarding identifier is the first identifier, wherein the fifth routing node is a routing node of a third type connected with the first routing node in the target network; when the node type of the first routing node is the second type, the node type of the second routing node is the first type, and the forwarding identifier is the second identifier, modifying the forwarding identifier in the target data packet to the first identifier, and forwarding the target data packet to a sixth routing node through a data transmission channel different from a target data transmission channel in two data transmission channels between the first routing node and the sixth routing node; the sixth routing node is a routing node different from the second routing node in two routing nodes of a first type, which are connected with the first routing node, in the target network, the first identifier is used for indicating that the target data packet is forwarded based on a shortest path, and the second identifier is used for indicating that the target data packet is not forwarded based on the shortest path and is required to be forwarded by using the target data transmission channel.
In an exemplary embodiment, the second forwarding module 136 is further configured to determine, from a plurality of routing nodes of a third type connected to the first routing node in the target network, a fifth routing node in the target network where the data transmission channel is unoccupied before forwarding the target data packet to the fifth routing node.
In an exemplary embodiment, the second forwarding module 136 is further configured to forward the target data packet according to the node type of the first routing node, the node type of the second routing node, and the forwarding identifier by: determining a seventh routing node according to a target port number of a target port carried in the target data packet when the node type of the first routing node is the second type, the node type of the second routing node is the third type, and the forwarding identifier is a first identifier, wherein the seventh routing node is a routing node of a first type corresponding to the target port in the target network, and the first identifier is used for indicating that the target data packet is forwarded based on a shortest path; forwarding the target data packet to the seventh routing node.
In an exemplary embodiment, the second forwarding module 136 is further configured to determine the seventh routing node according to the destination port number of the destination port carried in the destination data packet by: dividing the target port number by a first threshold to obtain a fifth result, wherein the first threshold is equal to the target number; determining a first preset routing node of two first types of routing nodes corresponding to the first routing node in the target network as the seventh routing node under the condition that the integer digits of the fifth result are even; and under the condition that the integer digits of the fifth result are odd numbers, determining a second preset routing node as the seventh routing node in two first type routing nodes corresponding to the first routing node in the target network.
In an exemplary embodiment, the second forwarding module 136 is further configured to forward the target data packet to the seventh routing node by: determining whether a data transmission channel between the first routing node and the seventh routing node is occupied; directly forwarding the target data packet to the seventh routing node under the condition that a data transmission channel is unoccupied between the first routing node and the seventh routing node; when the data transmission channels between the first routing node and the seventh routing node are occupied and the data packet transmission is determined to be carried out by using a target data transmission channel between the first routing node and an eighth routing node, modifying a forwarding identifier in the target data packet to a second identifier corresponding to the target data transmission channel, and forwarding the target data packet to the eighth routing node so as to forward the target data packet to the seventh routing node through the eighth routing node; the eighth routing node is a routing node different from the seventh routing node among two routing nodes of the first type connected with the first routing node in the target network, and the second identifier is used for indicating that the target data packet is not forwarded based on a shortest path and is required to be forwarded by using the target data transmission channel.
In an exemplary embodiment, the second forwarding module 136 is further configured to forward the target data packet according to the node type of the first routing node, the node type of the second routing node, and the forwarding identifier by: determining a ninth routing node according to a target port number of a target port carried in the target data packet when the node type of the first routing node is the third type, the node type of the second routing node is the second type, and the forwarding identifier is a first identifier, wherein the ninth routing node is a routing node of the second type corresponding to the target port in the target network, and the first identifier is used for indicating that the target data packet is forwarded based on a shortest path; forwarding the target data packet to the ninth routing node.
In an exemplary embodiment, the second forwarding module 136 is further configured to determine the ninth routing node according to the destination port number of the destination port carried in the destination data packet, by including: dividing the target port number by a second threshold to obtain a sixth result, wherein the second threshold is equal to twice the target number; and determining the routing node numbered as the integer digit of the sixth result in the target network as the ninth routing node.
It should be noted that each of the above modules may be implemented by software or hardware, and for the latter, it may be implemented by, but not limited to: the modules are all located in the same processor; alternatively, the above modules may be located in different processors in any combination.
Embodiments of the present application also provide a computer readable storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the method embodiments described above when run.
In one exemplary embodiment, the computer readable storage medium may include, but is not limited to: a usb disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing a computer program.
Embodiments of the present application also provide an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
In an exemplary embodiment, the electronic device may further include a transmission device connected to the processor, and an input/output device connected to the processor.
Specific examples in this embodiment may refer to the examples described in the foregoing embodiments and the exemplary implementation, and this embodiment is not described herein.
It will be appreciated by those skilled in the art that the modules or steps of the application described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, they may be implemented in program code executable by computing devices, so that they may be stored in a storage device for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than that shown or described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps of them may be fabricated into a single integrated circuit module. Thus, the present application is not limited to any specific combination of hardware and software.
The foregoing description is only of the preferred embodiments of the present application and is not intended to limit the same, but rather, various modifications and variations may be made by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the principles of the present application should be included in the protection scope of the present application.

Claims (20)

1. A method for forwarding a data packet, comprising:
under the condition that a first routing node in a target network acquires a target data packet, determining whether the target data packet carries a forwarding identifier, wherein the forwarding identifier is used for indicating a forwarding mode of the target data packet;
judging whether the target data packet needs to be forwarded to a routing node in the target network or not under the condition that the forwarding identifier is not carried in the target data packet; under the condition that the target data packet is judged to need to be forwarded to a routing node in the target network, determining a forwarding routing node and a corresponding forwarding identifier; setting the forwarding identifier in the target data packet, and forwarding the target data packet to the forwarding routing node according to the forwarding identifier;
Forwarding the target data packet according to the node type of the first routing node, the node type of a second routing node and the forwarding identifier under the condition that the forwarding identifier is carried in the target data packet, wherein the second routing node is a node which sends the target data packet to the first routing node in the target network;
wherein the target network comprises a plurality of routing nodes, and the routing nodes comprise: a first type of routing node, a second type of routing node, a third type of routing node; each second type of routing node in the target network is connected with two first type of routing nodes, two data transmission channels are arranged between each second type of routing node and each first type of routing node, two data transmission channels are arranged between each second type of routing node, each second type of routing node in the target network is connected with each third type of routing node in the target network, each first type of routing node in the target network is connected with a target number of ports, and the ports are used for receiving and sending data packets;
Wherein determining whether the target data packet needs to be forwarded to a routing node in the target network includes: acquiring a source port number of a source port and a target port number of a target port from the target data packet, wherein the target data packet is a data packet acquired from the source port by the first routing node, and the target data packet is to be forwarded to the target port; judging whether the first type of routing nodes corresponding to the source port and the target port in the target network are the same according to the source port number and the target port number; and under the condition that the source port and the target port are different in the corresponding routing nodes of the first type in the target network, judging that the target data packet needs to be forwarded to the routing nodes in the target network.
2. The method according to claim 1, wherein the method further comprises:
under the condition that the source port and the target port are the same in the corresponding routing nodes of the first type in the target network, judging that the target data packet does not need to be forwarded to the routing nodes in the target network;
forwarding the target data packet to the target port through the first routing node.
3. The method of claim 1, wherein determining forwarding routing nodes and corresponding forwarding identifications comprises:
judging whether the second type of routing nodes corresponding to the source port and the target port in the target network are the same according to the source port number and the target port number;
determining whether a data transmission channel between the first routing node and a third routing node is occupied or not under the condition that the source port and the target port are different in the corresponding routing nodes of the second type in the target network, wherein the third routing node is the routing node of the second type which is directly connected with the first routing node in the target network;
and determining a forwarding routing node and a corresponding forwarding identifier according to the occupation condition of the data transmission channel between the first routing node and the third routing node.
4. A method according to claim 3, wherein determining a forwarding routing node and a corresponding forwarding identifier based on occupancy of a data transmission path between the first routing node and a third routing node comprises:
under the condition that a data transmission channel is unoccupied between the first routing node and the third routing node, determining that the forwarding routing node is the third routing node, and determining a corresponding forwarding identifier as a first identifier, wherein the first identifier is used for indicating the forwarding of the target data packet based on a shortest path;
Under the condition that data transmission channels between the first routing node and the third routing node are occupied, determining the forwarding routing node as a fourth routing node, wherein the fourth routing node is the first type routing node connected with the first routing node in the target network;
and under the condition that the target data transmission channel between the first routing node and the fourth routing node is used for transmitting the data packet, determining a corresponding forwarding identifier as a second identifier corresponding to the target data transmission channel, wherein the second identifier is used for indicating that the target data packet is not forwarded based on a shortest path and the target data transmission channel is required to be used for forwarding.
5. A method according to claim 3, characterized in that the method further comprises:
determining whether a data transmission channel between the first routing node and a fourth routing node is occupied or not under the condition that the source port and the target port are the same in a corresponding routing node of a second type in the target network, wherein the fourth routing node is the routing node of the first type connected with the first routing node in the target network;
And determining a forwarding routing node and a corresponding forwarding identifier according to the occupation condition of the data transmission channel between the first routing node and the fourth routing node.
6. The method of claim 5, wherein determining forwarding routing nodes and corresponding forwarding identifiers based on occupancy of data transmission channels between the first routing node and a fourth routing node, comprises:
under the condition that a data transmission channel is unoccupied between the first routing node and the fourth routing node, determining that the forwarding routing node is the fourth routing node, and determining a corresponding forwarding identifier as a first identifier, wherein the first identifier is used for indicating the forwarding of the target data packet based on a shortest path;
under the condition that data transmission channels between the first routing node and the fourth routing node are occupied, determining the forwarding routing node as a third routing node, wherein the third routing node is the second type routing node connected with the first routing node in the target network;
and under the condition that the target data transmission channel between the first routing node and the third routing node is used for transmitting the data packet, determining a corresponding forwarding identifier as a second identifier corresponding to the target data transmission channel, wherein the second identifier is used for indicating that the target data packet is not forwarded based on a shortest path and the target data transmission channel is required to be used for forwarding.
7. The method of claim 3, wherein the step of,
judging whether the first type of routing nodes corresponding to the source port and the target port in the target network are the same according to the source port number and the target port number, wherein the method comprises the following steps: dividing the target port number by a first threshold value to obtain a first result; dividing the source port number by the first threshold value to obtain a second result; determining that the corresponding first type routing nodes of the source port and the target port in the target network are the same under the condition that the whole digits of the first result and the second result are the same; wherein the first threshold is equal to the target number; determining that the corresponding first type of routing nodes of the source port and the target port in the target network are different under the condition that the integral digits of the first result and the second result are different;
judging whether the second type of routing nodes corresponding to the source port and the target port in the target network are the same according to the source port number and the target port number, including: dividing the target port number by a second threshold value to obtain a third result; dividing the source port number by the second threshold value to obtain a fourth result; determining that the corresponding second type routing nodes of the source port and the target port in the target network are the same under the condition that the third result and the fourth result are the same in integer digits; wherein the second threshold is equal to twice the target number; and under the condition that the third result is different from the fourth result in integer digits, determining that the corresponding second type of routing nodes of the source port and the target port in the target network are different.
8. The method according to claim 1, wherein forwarding the target data packet to the forwarding routing node is based on the forwarding identification:
when the forwarding identifier indicates a data transmission channel, forwarding the target data packet to the forwarding routing node by using the data transmission channel indicated by the forwarding identifier;
and forwarding the target data packet to the forwarding routing node by using an unoccupied data transmission channel between the first routing node and the forwarding routing node under the condition that the forwarding identifier does not indicate the data transmission channel.
9. The method of claim 1, wherein forwarding the target data packet according to the node type of the first routing node, the node type of the second routing node, and the forwarding identifier comprises:
forwarding the target data packet to the target port according to the target port number of the target port carried in the target data packet when the node type of the first routing node is the first type, the node type of the second routing node is the second type, and the forwarding identifier is the first identifier;
When the node type of the first routing node is the first type, the node type of the second routing node is the second type, and the forwarding identifier is the second identifier, modifying the forwarding identifier in the target data packet to the first identifier, and forwarding the target data packet to a fourth routing node through a data transmission channel different from a target data transmission channel in two data transmission channels between the first routing node and the fourth routing node;
the fourth routing node is the first type of routing node connected with the first routing node in the target network; the first identifier is used for indicating that the target data packet is forwarded based on a shortest path, and the second identifier is used for indicating that the target data packet is not forwarded based on the shortest path and is required to be forwarded by using the target data transmission channel.
10. The method of claim 1, wherein forwarding the target data packet according to the node type of the first routing node, the node type of the second routing node, and the forwarding identifier comprises:
Forwarding the target data packet to the target port according to the target port number of the target port carried in the target data packet when the node type of the first routing node is the first type, the node type of the second routing node is the first type, and the forwarding identifier is the first identifier;
when the node type of the first routing node is the first type, the node type of the second routing node is the first type, and the forwarding identifier is the second identifier, modifying the forwarding identifier in the target data packet to the first identifier, and forwarding the target data packet to a third routing node through a data transmission channel different from a target data transmission channel in two data transmission channels between the first routing node and the third routing node;
wherein the third routing node is the second type of routing node connected to the first routing node in the target network; the first identifier is used for indicating that the target data packet is forwarded based on a shortest path, and the second identifier is used for indicating that the target data packet is not forwarded based on the shortest path and is required to be forwarded by using the target data transmission channel.
11. The method of claim 1, wherein forwarding the target data packet according to the node type of the first routing node, the node type of the second routing node, and the forwarding identifier comprises:
forwarding the target data packet to a fifth routing node under the condition that the node type of the first routing node is the second type, the node type of the second routing node is the first type, and the forwarding identifier is the first identifier, wherein the fifth routing node is a routing node of a third type connected with the first routing node in the target network;
when the node type of the first routing node is the second type, the node type of the second routing node is the first type, and the forwarding identifier is the second identifier, modifying the forwarding identifier in the target data packet to the first identifier, and forwarding the target data packet to a sixth routing node through a data transmission channel different from a target data transmission channel in two data transmission channels between the first routing node and the sixth routing node;
The sixth routing node is a routing node different from the second routing node in two routing nodes of a first type, which are connected with the first routing node, in the target network, the first identifier is used for indicating that the target data packet is forwarded based on a shortest path, and the second identifier is used for indicating that the target data packet is not forwarded based on the shortest path and is required to be forwarded by using the target data transmission channel.
12. The method of claim 11, wherein prior to forwarding the target data packet to a fifth routing node, the method further comprises:
and determining a fifth routing node with unoccupied data transmission channels from a plurality of routing nodes of a third type connected with the first routing node in the target network.
13. The method of claim 1, wherein forwarding the target data packet according to the node type of the first routing node, the node type of the second routing node, and the forwarding identifier comprises:
determining a seventh routing node according to a target port number of a target port carried in the target data packet when the node type of the first routing node is the second type, the node type of the second routing node is the third type, and the forwarding identifier is a first identifier, wherein the seventh routing node is a routing node of a first type corresponding to the target port in the target network, and the first identifier is used for indicating that the target data packet is forwarded based on a shortest path;
Forwarding the target data packet to the seventh routing node.
14. The method of claim 13, wherein determining a seventh routing node based on the destination port number of the destination port carried in the destination data packet comprises:
dividing the target port number by a first threshold to obtain a fifth result, wherein the first threshold is equal to the target number;
determining a first preset routing node of two first types of routing nodes corresponding to the first routing node in the target network as the seventh routing node under the condition that the integer digits of the fifth result are even;
and under the condition that the integer digits of the fifth result are odd numbers, determining a second preset routing node as the seventh routing node in two first type routing nodes corresponding to the first routing node in the target network.
15. The method of claim 14, wherein forwarding the target data packet to the seventh routing node comprises:
determining whether a data transmission channel between the first routing node and the seventh routing node is occupied;
directly forwarding the target data packet to the seventh routing node under the condition that a data transmission channel is unoccupied between the first routing node and the seventh routing node;
When the data transmission channels between the first routing node and the seventh routing node are occupied and the data packet transmission is determined to be carried out by using a target data transmission channel between the first routing node and an eighth routing node, modifying a forwarding identifier in the target data packet to a second identifier corresponding to the target data transmission channel, and forwarding the target data packet to the eighth routing node so as to forward the target data packet to the seventh routing node through the eighth routing node;
the eighth routing node is a routing node different from the seventh routing node among two routing nodes of the first type connected with the first routing node in the target network, and the second identifier is used for indicating that the target data packet is not forwarded based on a shortest path and is required to be forwarded by using the target data transmission channel.
16. The method of claim 1, wherein forwarding the target data packet according to the node type of the first routing node, the node type of the second routing node, and the forwarding identifier comprises:
determining a ninth routing node according to a target port number of a target port carried in the target data packet when the node type of the first routing node is the third type, the node type of the second routing node is the second type, and the forwarding identifier is a first identifier, wherein the ninth routing node is a routing node of the second type corresponding to the target port in the target network, and the first identifier is used for indicating that the target data packet is forwarded based on a shortest path;
Forwarding the target data packet to the ninth routing node.
17. The method of claim 16, wherein determining the ninth routing node based on the destination port number of the destination port carried in the destination data packet comprises:
dividing the target port number by a second threshold to obtain a sixth result, wherein the second threshold is equal to twice the target number;
and determining the routing node numbered as the integer digit of the sixth result in the target network as the ninth routing node.
18. A packet forwarding apparatus, comprising:
the determining module is used for determining whether a forwarding identifier is carried in a target data packet or not under the condition that a first routing node in a target network acquires the target data packet, wherein the forwarding identifier is used for indicating a forwarding mode of the target data packet;
the first forwarding module is used for judging whether the target data packet needs to be forwarded to a routing node in the target network or not under the condition that the forwarding identifier is not carried in the target data packet; under the condition that the target data packet is judged to need to be forwarded to a routing node in the target network, determining a forwarding routing node and a corresponding forwarding identifier; setting the forwarding identifier in the target data packet, and forwarding the target data packet to the forwarding routing node according to the forwarding identifier;
The second forwarding module is configured to forward, when the target data packet carries the forwarding identifier, the target data packet according to a node type of the first routing node, a node type of a second routing node, and the forwarding identifier, where the second routing node is a node in the target network that sends the target data packet to the first routing node;
wherein the target network comprises a plurality of routing nodes, and the routing nodes comprise: a first type of routing node, a second type of routing node, a third type of routing node; each second type of routing node in the target network is connected with two first type of routing nodes, two data transmission channels are arranged between each second type of routing node and each first type of routing node, two data transmission channels are arranged between each second type of routing node, each second type of routing node in the target network is connected with each third type of routing node in the target network, each first type of routing node in the target network is connected with a target number of ports, and the ports are used for receiving and sending data packets;
The first forwarding module is further configured to determine whether the target data packet needs to be forwarded to a routing node in the target network by: acquiring a source port number of a source port and a target port number of a target port from the target data packet, wherein the target data packet is a data packet acquired from the source port by the first routing node, and the target data packet is to be forwarded to the target port; judging whether the first type of routing nodes corresponding to the source port and the target port in the target network are the same according to the source port number and the target port number; and under the condition that the source port and the target port are different in the corresponding routing nodes of the first type in the target network, judging that the target data packet needs to be forwarded to the routing nodes in the target network.
19. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program, wherein the computer program, when executed by a processor, implements the steps of the method of any of claims 1 to 17.
20. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method as claimed in any one of claims 1 to 17 when the computer program is executed.
CN202311348891.5A 2023-10-18 2023-10-18 Data packet forwarding method and device, storage medium and electronic equipment Active CN117097661B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311348891.5A CN117097661B (en) 2023-10-18 2023-10-18 Data packet forwarding method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311348891.5A CN117097661B (en) 2023-10-18 2023-10-18 Data packet forwarding method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN117097661A CN117097661A (en) 2023-11-21
CN117097661B true CN117097661B (en) 2024-02-20

Family

ID=88783652

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311348891.5A Active CN117097661B (en) 2023-10-18 2023-10-18 Data packet forwarding method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN117097661B (en)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106961707A (en) * 2017-03-06 2017-07-18 哈尔滨工程大学 Based on connective Multifactor Decision Making Routing Protocol in a kind of VANET
CN109981458A (en) * 2019-03-08 2019-07-05 华为技术有限公司 A kind of method, network node and the system of determining message forwarding path
CN111355659A (en) * 2018-12-20 2020-06-30 深圳市中兴微电子技术有限公司 Data sending method and device, equipment and storage medium
CN112491713A (en) * 2019-09-11 2021-03-12 华为技术有限公司 Data transmission control method and device
CN112822127A (en) * 2020-12-29 2021-05-18 北京灵汐科技有限公司 Data broadcasting method, device, chip and medium of network on chip
CN114124787A (en) * 2020-08-31 2022-03-01 华为技术有限公司 Data sending method, device, equipment and hybrid network
CN114189451A (en) * 2022-02-16 2022-03-15 中国电子科技网络信息安全有限公司 Method for identifying target network backbone node
CN116320068A (en) * 2022-09-05 2023-06-23 Oppo广东移动通信有限公司 Data transmission method and device, electronic equipment and computer storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4887897B2 (en) * 2006-05-12 2012-02-29 富士通株式会社 Packet transmission device, packet transmission method and packet transmission system
US8542691B2 (en) * 2009-06-30 2013-09-24 Oracle International Corporation Classes of service for network on chips
US11637775B2 (en) * 2021-02-19 2023-04-25 Pensando Systems Inc. Methods and systems for location identifier based forwarding

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106961707A (en) * 2017-03-06 2017-07-18 哈尔滨工程大学 Based on connective Multifactor Decision Making Routing Protocol in a kind of VANET
CN111355659A (en) * 2018-12-20 2020-06-30 深圳市中兴微电子技术有限公司 Data sending method and device, equipment and storage medium
CN109981458A (en) * 2019-03-08 2019-07-05 华为技术有限公司 A kind of method, network node and the system of determining message forwarding path
CN112491713A (en) * 2019-09-11 2021-03-12 华为技术有限公司 Data transmission control method and device
CN114124787A (en) * 2020-08-31 2022-03-01 华为技术有限公司 Data sending method, device, equipment and hybrid network
CN112822127A (en) * 2020-12-29 2021-05-18 北京灵汐科技有限公司 Data broadcasting method, device, chip and medium of network on chip
CN114189451A (en) * 2022-02-16 2022-03-15 中国电子科技网络信息安全有限公司 Method for identifying target network backbone node
CN116320068A (en) * 2022-09-05 2023-06-23 Oppo广东移动通信有限公司 Data transmission method and device, electronic equipment and computer storage medium

Also Published As

Publication number Publication date
CN117097661A (en) 2023-11-21

Similar Documents

Publication Publication Date Title
CN102859949B (en) For the method in fat tree network routing data grouping
CN102571587B (en) Method and equipment for forwarding messages
CN102075437B (en) Communication method, gateway and network
CN107547391B (en) Message transmission method and device
US9600440B2 (en) Network topology of hierarchical ring with recursive shortcuts
Scheideler Models and techniques for communication in dynamic networks
CN102763380A (en) Distributed routing architecture
US8825986B2 (en) Switches and a network of switches
CN101753455B (en) Forwarding method and device thereof
CN102904825A (en) Hash based message transmission method and device
US10298485B2 (en) Systems and methods for NoC construction
CN105075199A (en) Direct network having plural distributed connections to each resource
CN104639437A (en) Forwarding method and apparatus of broadcast messages in stack system
US20150117224A1 (en) Network Topology of Hierarchical Ring with Gray Code and Binary Code
CN104410527A (en) Topological detection method, exchanger and heat stacking system
CN109873766B (en) Message transmission method and device
CN103873367A (en) Deadlock-free routing of data packets in fat tree networks
EP3442172B1 (en) Network topology system and building methods for topologies and routing tables thereof
CN108092896B (en) Stacking system and aggregation group creation apparatus
CN103457855A (en) Method and device for establishing classless inter-domain routing table and forwarding messages
CN117097661B (en) Data packet forwarding method and device, storage medium and electronic equipment
CN106254282B (en) The implementation method and device of link aggregation
CN101980487A (en) Method for device for selecting exit of route
CN106685821A (en) Multipath selection method and multipath selection equipment
CN113824633B (en) Method for releasing route in campus network and network equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant