Data message forwarding method, computer equipment, storage medium and program product
By constructing a port forwarding mapping table in the switching network and forwarding data packets based on port relationships, the flooding problem when the destination MAC address is not found in the MAC address table is solved, and efficient utilization of network resources is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN INOVANCE TECH CO LTD
- Filing Date
- 2026-02-03
- Publication Date
- 2026-05-15
AI Technical Summary
In existing switching networks, when the destination MAC address cannot be found in the MAC address table, data packets flood, resulting in a waste of network resources.
By obtaining the connection relationships between nodes and ports in the switching network, a port forwarding mapping table is established, and data packets are forwarded based on port relationships, avoiding the use of port flooding.
It reduces the waste of network resources caused by port flooding in the switching network and improves the efficiency of data packet forwarding.
Smart Images

Figure CN122053539A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a data packet forwarding method, computer equipment, storage medium, and program product. Background Technology
[0002] In industrial wired communication scenarios, switching networks are widely used. A switching network consists of multiple switching devices connected together, and its network structure is generally in the form of bus, star, and ring topologies.
[0003] Current switching networks use standard MAC (Media Access Control Address) addresses for forwarding. They forward data by querying a MAC address table (a table that describes the correspondence between MAC addresses and ports). Switching devices update the entries in the MAC address table through learning.
[0004] If the destination MAC address of the data packet is not found in the MAC address table, the switching device will flood the packet out from all ports except the receiving port, resulting in a serious waste of network resources. Summary of the Invention
[0005] Therefore, it is necessary to provide a data packet forwarding method, computer equipment, storage medium, and program product that can reduce network resource waste in response to the above-mentioned technical problems.
[0006] Firstly, this application also provides a data packet forwarding method, applied to a network management node in a switching network, the method comprising:
[0007] Obtain the node connection relationships and port connection relationships between all nodes in the switching network;
[0008] Based on node connection relationships and port connection relationships, a mapping relationship is established between the receiving port of each node and the target port and forwarding port corresponding to the receiving port, resulting in a port forwarding mapping table;
[0009] Configure the port forwarding mapping table on each node for data packet forwarding.
[0010] In one embodiment, based on node connection relationships and port connection relationships, a mapping relationship is established between the receiving port of each node and the corresponding target port and forwarding port, resulting in a port forwarding mapping table, including:
[0011] Determine whether the target port and the receiving port are within the same node of the switching network;
[0012] When the target port and the receiving port are in the same node under the switching network, the target port is determined as the forwarding port, and the mapping relationship between the receiving port and the target port and the forwarding port is obtained.
[0013] When the target port and the receiving port are located in different nodes in the switching network, the connecting port is determined as the forwarding port according to the node connection relationship and the port connection relationship, and the mapping relationship between the receiving port, the target port and the forwarding port is obtained. The connecting port is the port in the node that connects to other nodes except for the receiving port.
[0014] Based on the mapping relationship between the receiving port, the target port, and the forwarding port, a port forwarding mapping table is constructed.
[0015] In one embodiment, the switching network includes a ring switching network;
[0016] Before determining the connection port as the forwarding port, the following steps are also included:
[0017] When a node is in a ring switching network, at least one port in the node that connects to other nodes is identified as a connection port.
[0018] In one embodiment, the switching network further includes a non-ring switching network;
[0019] Before determining the connection port as the forwarding port, the following steps are also included:
[0020] When a node is in a non-ring switching network, the port that is directly or indirectly connected to the node where the target port is located is determined as the connection port.
[0021] In one embodiment, determining the connection port as a forwarding port includes:
[0022] In the case of at least two connection ports, determine the number of forwarding nodes that each connection port traverses to reach the target port;
[0023] The connection port that receives the fewest forwarding nodes is determined as the forwarding port.
[0024] Secondly, this application provides a data packet forwarding method, applicable to any node in a switching network, the method comprising:
[0025] After receiving the data packet to be forwarded, determine the port information of the receiving port for receiving the data packet;
[0026] The forwarding port information that matches the target port information and the receiving port information is retrieved from the pre-stored port forwarding mapping table. The port forwarding mapping table includes the forwarding ports corresponding to the ports of each node in the switching network when they are used as receiving ports or target ports.
[0027] Data packets are sent out through the forwarding port.
[0028] In one embodiment, sending data packets via a forwarding port includes:
[0029] When the forwarding port and the destination port are the same, the data packet is sent through the forwarding port so that the data packet is sent from the destination port that is the same as the forwarding port;
[0030] If the forwarding port and the target port are inconsistent, the data packet is sent to the next node through the forwarding port until the data packet is forwarded to the target port.
[0031] Thirdly, this application also provides a data packet forwarding apparatus, comprising:
[0032] The relationship acquisition module is used to acquire the node connection relationships and port connection relationships between all nodes in the switching network.
[0033] The mapping table construction module is used to establish a mapping relationship between the receiving port of each node and the target port and forwarding port corresponding to the receiving port based on the node connection relationship and the port connection relationship, so as to obtain the port forwarding mapping table;
[0034] The mapping table configuration module is used to configure the port forwarding mapping table to each of the nodes for data packet forwarding.
[0035] Fourthly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0036] Obtain the node connection relationships and port connection relationships between all nodes in the switching network;
[0037] Based on the node connection relationship and the port connection relationship, a mapping relationship is established between the receiving port of each node and the target port and forwarding port corresponding to the receiving port, thus obtaining a port forwarding mapping table;
[0038] The port forwarding mapping table is configured on each node for data packet forwarding.
[0039] Fifthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0040] Obtain the node connection relationships and port connection relationships between all nodes in the switching network;
[0041] Based on the node connection relationship and the port connection relationship, a mapping relationship is established between the receiving port of each node and the target port and forwarding port corresponding to the receiving port, thus obtaining a port forwarding mapping table;
[0042] The port forwarding mapping table is configured on each node for data packet forwarding.
[0043] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:
[0044] Obtain the node connection relationships and port connection relationships between all nodes in the switching network;
[0045] Based on the node connection relationship and the port connection relationship, a mapping relationship is established between the receiving port of each node and the target port and forwarding port corresponding to the receiving port, thus obtaining a port forwarding mapping table;
[0046] The port forwarding mapping table is configured on each node for data packet forwarding.
[0047] The aforementioned data packet forwarding method, computer equipment, storage medium, and program product obtain the node connection relationships and port connection relationships among all nodes in the switching network. Based on these relationships, a mapping relationship is established between the receiving port of each node and the corresponding target port and forwarding port, resulting in a port forwarding mapping table. This port forwarding mapping table is then configured on each node for data packet forwarding. By decoupling ports from MAC addresses, this application constructs a port forwarding mapping table based on the relationships between the ports of each node. A node can query the port forwarding mapping table based on the target port and the receiving port of the received data packet to determine the forwarding port on the current node used to send the data packet. This eliminates the need for port flooding, reducing network resource waste caused by port flooding in the switching network. Attached Figure Description
[0048] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0049] Figure 1This is a schematic diagram of the network structure of a switching network in one embodiment;
[0050] Figure 2 This is a flowchart illustrating a data packet forwarding method in one embodiment;
[0051] Figure 3 This is a flowchart illustrating a data packet forwarding method in another embodiment;
[0052] Figure 4 This is a flowchart illustrating the data packet forwarding method in yet another embodiment;
[0053] Figure 5 This is a packet structure diagram of a data packet in one embodiment;
[0054] Figure 6 This is a schematic diagram of a data packet forwarding method in one embodiment;
[0055] Figure 7 This is a structural block diagram of a data packet forwarding device in one embodiment;
[0056] Figure 8 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0057] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0058] It should be noted that the terms "first," "second," etc., used in this application can be used to describe various elements, but these elements are not limited by these terms. These terms are only used to distinguish the first element from the second element. The terms "comprising" and "having," and any variations thereof, used in this application, are intended to cover non-exclusive inclusion. The term "multiple" used in this application refers to two or more. The term "and / or" used in this application refers to one of the embodiments, or any combination of multiple embodiments.
[0059] The data packet forwarding method provided in this application embodiment can be applied to, for example, Figure 1 The application environment shown depicts a switching network comprised of multiple nodes that communicate via connections between ports. For example... Figure 1As shown, the switching network consists of four nodes: Node 1, Node 2, Node 3, and Node 4. Node 1 includes ports 11, 12, 13, and 14; Node 2 includes ports 21, 22, 23, and 24; Node 3 includes ports 31, 32, 33, and 34; and Node 4 includes ports 41, 42, 43, and 44. Port 12 of Node 1 is connected to port 21 of Node 2; port 21 of Node 2 is connected to port 31 of Node 3; port 32 of Node 3 is connected to port 41 of Node 4; and port 42 of Node 4 is connected to port 11 of Node 1, thus forming a ring switching network. It is understood that the switching network in this application can also be a star, bus, or other non-ring switching network.
[0060] In one exemplary embodiment, such as Figure 2 As shown, this application also provides a data packet forwarding method applied to a network management node in a switching network, the method comprising steps 110 to 130. Wherein:
[0061] Step 110: Obtain the node connection relationships and port connection relationships between all nodes in the switching network.
[0062] Step 120: Based on the node connection relationship and port connection relationship, establish the mapping relationship between the receiving port and the target port corresponding to the receiving port of each node and the forwarding port to obtain the port forwarding mapping table;
[0063] Step 130: Configure the port forwarding mapping table to each node for data packet forwarding.
[0064] The network management node is the node that manages the switching network and communicates with all nodes in the switching network. Node connectivity refers to the connections between nodes in the switching network to determine the location of each node within the network. Port connectivity refers to the connections between the ports of each node in the switching network. Figure 1 Taking the ring switching network as an example, the node connection relationship is that node 1-node 2-node 3-node 4-node 1 are connected in a ring. The port connection relationship is that port 12 of node 1 is connected to port 21 of node 2, port 21 of node 2 is connected to port 31 of node 3, port 32 of node 3 is connected to port 41 of node 4, and port 42 of node 4 is connected to port 11 of node 1.
[0065] It should be noted that any port of any node in the switching network can be used as a receiving port, and any port in the switching network other than the receiving port can be used as the target port corresponding to the receiving port. The mapping relationship between the receiving port, target port, and forwarding port is a two-to-one relationship, that is, the two items of receiving port and target port correspond to the item of forwarding port. It can be understood that the item of forwarding port can be one or more ports.
[0066] In this embodiment, after obtaining the node connection relationships and port connection relationships among all nodes in the switching network, the network management node can determine the mapping relationship between any port of a node as a receiving port and other ports (excluding the receiving port and the connection ports of each node) as target ports, and then construct a port forwarding mapping table based on this mapping relationship. For example, when the target port and the receiving port are within the same node in the switching network, the target port is determined as the forwarding port, obtaining the mapping relationship between the receiving port, the target port, and the forwarding port. When the target port and the receiving port are within different nodes in the switching network, the connection port is determined as the forwarding port according to the node connection relationships and port connection relationships, obtaining the mapping relationship between the receiving port, the target port, and the forwarding port, where the connection port is the port of the node that connects to other nodes besides the receiving port. Furthermore, a port forwarding mapping table can be constructed based on the mapping relationship between the receiving port, the target port, and the forwarding port. For example, in this embodiment, node numbers can be allocated to each node according to the node connection relationships, and port numbers can be allocated to the ports of each node according to predetermined allocation rules (such as clockwise, counterclockwise, round-trip order, etc.) based on the node numbers. Then, based on the node connection relationship and port connection relationship, the mapping relationship between the receiving port, the target port and the forwarding port is determined, and the port numbers of the ports in each node are integrated to obtain the port forwarding mapping table.
[0067] The network management node can then configure port forwarding mapping tables on each node for data packet forwarding. Any node in the switching network, upon receiving a data packet to be forwarded, determines the port information of the receiving port, where the data packet includes target port information. It then queries a pre-stored port forwarding mapping table to find a forwarding port that matches both the target port information and the receiving port information, and forwards the data packet through that port. It is understood that the network management node can either configure the complete port forwarding mapping table and store it on all nodes in the switching network, or it can divide the port forwarding mapping table according to the node to which the receiving port belongs, obtaining a port forwarding mapping table for each node, and then configure the port forwarding mapping table for each node on the corresponding node in the switching network, so that each node stores its own port forwarding mapping table. By decoupling the port and MAC address, this embodiment constructs a port forwarding mapping table based on the relationship between the ports of each node. The node can query the port forwarding mapping table based on the target port and the receiving port of the received data packet to determine the forwarding port in the current node used to send the data packet. This eliminates the need to use the node's port flooding function and reduces the waste of network resources caused by port flooding in the switching network.
[0068] In an exemplary embodiment, based on node connection relationships and port connection relationships, a mapping relationship is established between the receiving port of each node and the corresponding target port and forwarding port to obtain a port forwarding mapping table, including steps 121 to 124. Wherein:
[0069] Step 121: Determine whether the target port and the receiving port are in the same node under the switching network.
[0070] Step 122: When the target port and the receiving port are in the same node under the switching network, the target port is determined as the forwarding port, and the mapping relationship between the receiving port and the target port and the forwarding port is obtained.
[0071] Step 123: When the target port and the receiving port are in different nodes under the switching network, the connecting port is determined as the forwarding port according to the node connection relationship and the port connection relationship, and the mapping relationship between the receiving port and the target port and the forwarding port is obtained. The connecting port is the port in the node that is connected to other nodes except for the receiving port.
[0072] Step 124: Based on the mapping relationship between the receiving port, the target port, and the forwarding port, construct a port forwarding mapping table.
[0073] In this embodiment, the network management node can determine whether to forward the data packet to a node other than the node where the receiving port is located by judging whether the target port and the receiving port are in the same node under the switching network. If the target port and the receiving port are in the same node under the switching network, it means there is no need to forward to other nodes, and the target port can be directly identified as the forwarding port, thus obtaining the mapping relationship between the receiving port, the target port, and the forwarding port. If the target port and the receiving port are in different nodes under the switching network, it means that forwarding to other nodes is required to forward the data packet to the target port. Therefore, based on the node connection relationship and port connection relationship, the connecting port can be identified as the forwarding port, thus obtaining the mapping relationship between the receiving port, the target port, and the forwarding port. The connecting port is a port in the node that connects to other nodes besides the receiving port, allowing the node to send the data packet from the connecting port to the next node connected to the node where the receiving port is located during the data packet forwarding process. It is understood that even if the receiving port is also a connecting port connected to other nodes, sending the data packet back from the receiving port obviously cannot achieve normal forwarding. Therefore, the connecting port identified as the forwarding port here needs to exclude the receiving port. Therefore, this embodiment can construct a port forwarding mapping table based on the mapping relationship between the receiving port and the target port and the forwarding port in these two cases.
[0074] In this embodiment, by obtaining the node connection relationship and port connection relationship between all nodes in the switching network, and based on the node connection relationship and port connection relationship, a mapping relationship between the receiving port of each node and the target port and forwarding port corresponding to the receiving port is established to obtain the port forwarding mapping table. This allows the port forwarding mapping table to abandon the traditional MAC address and port binding method in the MAC address table, and describe the forwarding method between ports by means of port connection relationship.
[0075] In one exemplary embodiment, the switching network includes a ring switching network; prior to determining the connection port as a forwarding port, the method further includes:
[0076] When a node is in a ring switching network, at least one port in the node that connects to other nodes is identified as a connection port.
[0077] Switching networks include various network architectures. For ring switching networks, such as... Figure 1As shown, data can be forwarded directly or indirectly to any node in the switching network from either port 11 or port 12. Therefore, at least one port in a node that connects to other nodes can be designated as a connection port. Alternatively, all ports in a node that connect to other nodes can be designated as connection ports. It can be understood that the forwarding port and the receiving port are different ports in the node. Therefore, if the receiving port is not a connection port in the node, any connection port in the node is used as a forwarding port. If the receiving port is a connection port in the node, any other connection port besides the receiving port is used as a forwarding port.
[0078] In one exemplary embodiment, the switching network further includes a non-ring switching network; before determining the connection port as a forwarding port, the following steps are also included:
[0079] When a node is in a non-ring switching network, the port that is directly or indirectly connected to the node where the target port is located is determined as the connection port.
[0080] Among them, non-ring switching networks can be switching networks with network structures other than ring, such as star and bus topologies.
[0081] For non-ring switching networks, unlike ring switching networks, it's difficult for each connection port of a node to directly or indirectly forward to any node in the network. Therefore, ports within a node that are directly or indirectly connected to the node containing the target port can be designated as connection ports. It's understood that this embodiment can determine ports within a node that are directly or indirectly connected to the node containing the target port based on port connection relationships. For example, if the first, second, third, and fourth nodes are connected sequentially, and the receiving port is located at the second node, then if the target endpoint is located at the first node, the port in the second node connected to the first node can be designated as a connection port. If the target endpoint is located at the third or fourth node, since the port in the second node connected to the third node is also indirectly connected to the fourth node, the port in the second node connected to the third node can also be designated as a connection port. Similarly, since forwarding ports and receiving ports are different ports within a node, if the receiving port is not a connection port within a node, the connection port within a node that is directly or indirectly connected to the node containing the target port is designated as a forwarding port. If the receiving port is a connection port within a node, any other connection port besides the receiving port is designated as a forwarding port.
[0082] In one exemplary embodiment, such as Figure 3 As shown, determining the connection port as the forwarding port includes steps 210 to 220, wherein:
[0083] Step 210: If there are at least two connection ports, determine the number of forwarding nodes that each connection port sends through to reach the target port.
[0084] Step 220: Determine the connection port with the fewest number of forwarding nodes as the forwarding port.
[0085] To further improve forwarding efficiency, in the presence of at least two connection ports, this embodiment can determine the number of forwarding nodes a data packet traverses from each forwarding port to the destination port based on the node connection relationships of each node in the switching network. The connection port corresponding to the minimum number of forwarding nodes traversed can then be determined as the forwarding port. (Refer to...) Figure 1 Taking port 13 as the receiving port and port 43 as the destination port as an example, the node where the destination port 43 is located is node 4, and the node where the receiving port 13 is located is node 1. Node 1 has two connection ports: port 11 and port 12. According to the node connection relationship of each node in the switching network, the number of forwarding nodes traversed from port 11 to node 4 is 0, while the number of forwarding nodes traversed from port 12 to node 4 is 2, meaning it needs to pass through nodes 2 and 3. Therefore, the connection port 11 corresponding to the fewest forwarding nodes is determined as the forwarding port for forwarding data packets. Thus, in this embodiment, the network management node can determine the number of forwarding nodes traversed from each connection port to the destination port when there are at least two connection ports, and determine the connection port corresponding to the fewest forwarding nodes as the forwarding port. By selecting the connection port with the fewest forwarding nodes as the forwarding port, the forwarding efficiency of data packets can be effectively improved when nodes forward data packets in the subsequent packet forwarding stage.
[0086] In one exemplary embodiment, such as Figure 4 As shown, a data packet forwarding method is provided, which can be applied to... Figure 1 Taking any node in the switching network as an example, the explanation includes the following steps 310 to 330. Wherein:
[0087] Step 310: After receiving the data packet to be forwarded, determine the port information of the receiving port for receiving the data packet.
[0088] The receiving port is the port in the node that receives the data packet. The port information of the receiving port is the identification information describing the receiving port, such as the port number and port code. The destination port information is the identification information describing the destination port, such as the destination port number and port code. The destination port is the port to which the data packet is expected to be sent.
[0089] For example, after receiving a data packet to be forwarded, a node can determine the port information of the receiving port that received the data packet and extract the target port information from the data packet. Figure 5 As shown, Figure 5 This is a schematic diagram of the data packet structure in an example. In this example, the destination address in the data packet may include OUI (Organizationally Unique Identifier), CtrlId (Control Identifier, used to identify the control domain), the destination node, and the destination port. The data packet also includes the source address describing the sender of the data packet, as well as the packet content.
[0090] Step 320: Query the pre-stored port forwarding mapping table to find the forwarding port information that matches the target port information and the receiving port information. The port forwarding mapping table includes the forwarding ports corresponding to the ports of each node in the switching network when they are used as receiving ports or target ports.
[0091] The port forwarding mapping table includes the forwarding ports corresponding to the ports of each node in the switching network when they are used as receiving or destination ports. It can be understood that there is a two-to-one relationship between receiving and destination ports and forwarding ports; that is, the receiving and destination ports correspond to the forwarding port entry. However, a forwarding port can be one or more ports. It can also be understood that since the connection ports of each node (i.e., ports used to connect different nodes) are used to connect to other nodes, these connection ports will be used as receiving or forwarding ports, but not as destination ports.
[0092] by Figure 1 Taking the switching network in the example, the port forwarding mapping table is shown in Table 1 below:
[0093] Table 1 Port Forwarding Map Table
[0094]
[0095] As shown in Table 1, the target node is the node where the target port is located. Ports 11, 12, 21, 22, 31, 32, 41, and 42, which are used as connection ports, will be used as receiving ports or forwarding ports, but will not be used as target ports.
[0096] Therefore, after determining the port information (port number of the receiving port) and the destination port information (port number of the destination port) of the received data packet, the node can query the pre-stored port forwarding mapping table to find the forwarding port information (port number of the forwarding port) that matches the destination port information and the receiving port information, thereby obtaining the forwarding port used by the node to send the data packet.
[0097] Step 330: Send the data packet through the forwarding port.
[0098] In this embodiment, after a node obtains the port information of the forwarding port, it can send data packets through the forwarding port. If multiple forwarding ports exist, the node can select one to send the data packet, or it can send the data packet through multiple forwarding ports separately. Furthermore, it is understood that although the node sends data packets through the forwarding port in different situations, the destination of the data packets after transmission differs. When the destination port and the receiving port are within the same node in the switching network, it means there is no need to forward the data packet to other nodes. In this case, the forwarding port is actually the destination port, and when the node sends the data packet through the forwarding port, it is essentially sending the data packet from the destination port. When the destination port and the receiving port are not within the same node in the switching network, it means the data packet needs to be forwarded to other nodes before it can be forwarded to the destination port. In this case, the forwarding port is actually the connection port other than the receiving port. When the node sends the data packet through the forwarding port, it is essentially sending the data packet from the connection port to the next node connected to it. The next node then executes the data packet forwarding method of this embodiment, namely, receiving the data packet to be forwarded, determining the port information of the receiving port of the received data packet, and understanding that the receiving port at this time is the port on which the next node received the data packet. Then, it queries the pre-stored port forwarding mapping table to find the forwarding port information that matches the target port information and the receiving port information, and sends the data packet through the forwarding port until the data packet is sent from the forwarding port that matches the target port.
[0099] In some embodiments, sending data packets through a forwarding port includes steps 331 to 332, wherein:
[0100] Step 331: If the forwarding port and the destination port are the same, send the data packet through the forwarding port so that the data packet is sent from the destination port that is the same as the forwarding port.
[0101] Step 332: If the forwarding port and the target port are inconsistent, the data packet is sent to the next node through the forwarding port until the data packet is forwarded to the target port.
[0102] In this embodiment, although the nodes send data packets through the forwarding port, the destination of the data packets after being sent through the forwarding port is different under different circumstances.
[0103] When the destination port and the receiving port are within the same node in the switching network, it means there's no need to forward the data packet to other nodes. In this case, the forwarding port is actually the destination port, and the node sending the data packet through the forwarding port is essentially sending the data packet from the destination port. When the destination port and the receiving port are not within the same node in the switching network, it means the data packet needs to be forwarded to other nodes before it can be forwarded to the destination port. In this case, the forwarding port is actually the connection port other than the receiving port. The node sending the data packet through the forwarding port is essentially sending the data packet from the connection port to the next node connected to it. The next node then also executes the data packet forwarding method of this embodiment, i.e., receiving the data packet to be forwarded, determining the port information of the receiving port that received the data packet (it should be understood that the receiving port is the port where this next node received the data packet), and then querying the pre-stored port forwarding mapping table to find the forwarding port information that matches the destination port information and the receiving port information. The data packet is then sent through the forwarding port until the data packet is sent from the forwarding port that matches the destination port.
[0104] In the aforementioned data packet forwarding method, after receiving a data packet to be forwarded, the port information of the receiving port is determined. A pre-stored port forwarding mapping table is then consulted to find the forwarding port information that matches the target port information and the receiving port information. This port forwarding mapping table includes the forwarding ports corresponding to the ports of each node in the switching network when used as either the receiving or target port. The data packet is then sent through the forwarding port. By decoupling ports from MAC addresses, this application constructs a port forwarding mapping table based on the relationships between the ports of each node. A node can query the port forwarding mapping table based on the target port and the receiving port of the received data packet to determine the forwarding port used to send the data packet. This eliminates the need for port flooding, reducing network resource waste caused by port flooding in the switching network.
[0105] like Figure 6 As shown, Figure 6 This is a schematic diagram illustrating a data packet forwarding method in one embodiment. In this embodiment, after node 2 receives data packet 100 at port 23, node 2 determines that the receiving port is port 23 and extracts the target address from data packet 100, obtaining that the target port in the target address is 34. Node 2 then queries a pre-stored port forwarding mapping table to obtain that the forwarding ports corresponding to the receiving port 23 and the target port 34 are port 21 and port 22, respectively. Node 2 can then forward data packet 100 from port 21 and port 22, respectively.
[0106] For data packet 100 sent from port 22, after node 3 receives data packet 100 from port 22 at port 31, node 3 determines that the receiving port is port 31, extracts the destination address from data packet 100, and obtains that the destination port in the destination address is 34. Node 3 then queries the pre-stored port forwarding mapping table to find that the forwarding port corresponding to the receiving port 31 and the destination port 34 is port 34, and then sends data packet 100 from port 34. It can be understood that at this time, port 34 is both the destination port and the forwarding port.
[0107] For data packet 100 sent from port 21, after receiving data packet 100 from port 21 at port 12 of node 1, node 1 determines that the receiving port is port 12, and extracts the destination address from data packet 100, obtaining that the destination port is 34. Node 1 then queries the pre-stored port forwarding mapping table and finds that the forwarding port corresponding to the receiving port 12 and the destination port 34 is port 11, and then sends data packet 100 from port 11. Similarly, after receiving data packet 100 from port 11 at port 42 of node 4, node 4 determines that the receiving port is port 42, and extracts the destination address from data packet 100, obtaining that the destination port is 34. Node 4 then queries the pre-stored port forwarding mapping table and finds that the forwarding port corresponding to the receiving port 42 and the destination port 34 is port 41, and then sends the data packet from port 41. After receiving data packet 100 from port 41, port 31 of node 3 determines that the receiving port is port 32, and extracts the destination address from data packet 100, obtaining that the destination port is 34. Node 3 then queries the pre-stored port forwarding mapping table to find that the forwarding port corresponding to the receiving port 32 and the destination port 34 is port 34, and then forwards data packet 100 from port 34. It can be understood that at this time, port 34 is both the destination port and the forwarding port.
[0108] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.
[0109] Based on the same inventive concept, this application also provides a data packet forwarding apparatus for implementing the data packet forwarding method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more data packet forwarding apparatus embodiments provided below can be found in the limitations of the data packet forwarding method described above, and will not be repeated here.
[0110] In one exemplary embodiment, such as Figure 7 As shown, a data packet forwarding device 400 is provided, including: a relationship acquisition module 410, a mapping table construction module 420, and a mapping table configuration module 430, wherein:
[0111] The relationship acquisition module 410 is used to acquire the node connection relationship and port connection relationship between all nodes in the switching network.
[0112] The mapping table construction module 420 is used to establish a mapping relationship between the receiving port of each node and the target port and forwarding port corresponding to the receiving port based on the node connection relationship and port connection relationship, so as to obtain the port forwarding mapping table;
[0113] The mapping table configuration module 430 is used to configure the port forwarding mapping table to each node for data packet forwarding.
[0114] In one embodiment, the mapping table construction module 420 is further configured to:
[0115] Determine whether the target port and the receiving port are within the same node in the switching network. If they are, the target port is designated as the forwarding port, thus establishing a mapping relationship between the receiving port, the target port, and the forwarding port. If they are within different nodes in the switching network, the connecting port is designated as the forwarding port based on node and port connection relationships, thus establishing a mapping relationship between the receiving port, the target port, and the forwarding port. The connecting port is the port in the node that connects to other nodes besides the receiving port. Based on the mapping relationship between the receiving port, the target port, and the forwarding port, a port forwarding mapping table is constructed.
[0116] In one embodiment, the switching network includes a ring switching network; the mapping table construction module 420 is further configured to:
[0117] When a node is in a ring switching network, at least one port in the node that connects to other nodes is identified as a connection port.
[0118] In one embodiment, the switching network further includes a non-ring switching network; the mapping table construction module 420 is also used for:
[0119] When a node is in a non-ring switching network, the port that is directly or indirectly connected to the node where the target port is located is determined as the connection port.
[0120] In one embodiment, the mapping table construction module 420 is further configured to:
[0121] If there are at least two connection ports, determine the number of forwarding nodes that each connection port passes through to reach the target port, and determine the connection port with the fewest forwarding nodes as the forwarding port.
[0122] This embodiment also provides another data packet forwarding device, including:
[0123] The receiving module is used to determine the port information of the receiving port of the data packet after receiving the data packet to be forwarded, wherein the data packet includes the target port information;
[0124] The query module is used to query the forwarding port information that matches the target port information and the receiving port information from the pre-stored port forwarding mapping table. The port forwarding mapping table includes the forwarding ports corresponding to the ports of each node in the switching network when they are used as receiving ports or target ports.
[0125] The sending module is used to send data packets through the forwarding port.
[0126] In one embodiment, the sending module is further configured to:
[0127] If the forwarding port is the same as the target port, the data packet is sent through the forwarding port so that the data packet is sent from the target port that is the same as the forwarding port. If the forwarding port is not the same as the target port, the data packet is sent through the forwarding port to the next node until the data packet is forwarded to the target port.
[0128] Each module in the aforementioned data packet forwarding device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0129] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 8 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When executed by the processor, the computer program implements a data packet forwarding method.
[0130] Those skilled in the art will understand that Figure 8 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0131] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the embodiments described above.
[0132] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps of the above embodiments.
[0133] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps of the above embodiments.
[0134] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0135] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0136] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0137] The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A data packet forwarding method, characterized in that, The method, applied to a network management node in a switching network, includes: Obtain the node connection relationships and port connection relationships between all nodes in the switching network; Based on the node connection relationship and the port connection relationship, a mapping relationship is established between the receiving port of each node, the target port corresponding to the receiving port, and the forwarding port to obtain the port forwarding mapping table; The port forwarding mapping table is configured on each node for data packet forwarding.
2. The method according to claim 1, characterized in that, Based on the node connection relationship and the port connection relationship, a mapping relationship is established between the receiving port of each node and the target port and forwarding port corresponding to the receiving port, resulting in a port forwarding mapping table, including: Determine whether the target port and the receiving port are located within the same node of the switching network; When the target port and the receiving port are in the same node under the switching network, the target port is determined as the forwarding port, and the mapping relationship between the receiving port and the target port and the forwarding port is obtained; When the target port and the receiving port are in different nodes under the switching network, the connecting port is determined as the forwarding port according to the node connection relationship and the port connection relationship, and the mapping relationship between the receiving port and the target port and the forwarding port is obtained, wherein the connecting port is the port in the node that is connected to other nodes besides the receiving port; Based on the mapping relationship between the receiving port, the target port, and the forwarding port, a port forwarding mapping table is constructed.
3. The method according to claim 2, characterized in that, The switching network includes a ring switching network; before determining the connection port as a forwarding port, the process further includes: When the node is in a ring switching network, at least one port of the node that connects to other nodes is identified as a connection port.
4. The method according to claim 2, characterized in that, The switching network also includes a non-ring switching network; before determining the connection port as a forwarding port, the process further includes: When the node is in a non-ring switching network, the port of the node that is directly or indirectly connected to the node where the target port is located is determined as the connection port.
5. The method according to claim 2, characterized in that, The step of determining the connection port as a forwarding port includes: In the presence of at least two connection ports, determine the number of forwarding nodes that the signal from each connection port must pass through to reach the target port; The connection port corresponding to the minimum number of forwarding nodes is determined as the forwarding port.
6. A data packet forwarding method, characterized in that, The method, applied to any node in a switching network, includes: After receiving a data packet to be forwarded, determine the port information of the receiving port that receives the data packet, wherein the data packet includes the target port information; The forwarding port information that matches the target port information and the receiving port information is retrieved from the pre-stored port forwarding mapping table, wherein the port forwarding mapping table includes the forwarding ports corresponding to the ports of each node in the switching network when they are used as receiving ports or target ports. The data packet is sent through the forwarding port.
7. The method according to claim 6, characterized in that, Sending the data packet through the forwarding port includes: When the forwarding port is the same as the target port, the data packet is sent through the forwarding port so that the data packet is sent from the target port that is the same as the forwarding port; If the forwarding port and the target port are inconsistent, the data packet is sent to the next node through the forwarding port until the data packet is forwarded to the target port.
8. A data packet forwarding device, characterized in that, The device includes: The relationship acquisition module is used to acquire the node connection relationships and port connection relationships between all nodes in the switching network. The mapping table construction module is used to establish a mapping relationship between the receiving port of each node and the target port and forwarding port corresponding to the receiving port based on the node connection relationship and the port connection relationship, so as to obtain the port forwarding mapping table; The mapping table configuration module is used to configure the port forwarding mapping table to each of the nodes for data packet forwarding.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 7.