A network switching method, device, equipment and computer program product

By canceling the dedicated switching chip, the network switching function is realized by using the connection between the central processor and the PHY chip, the cost and failure problems of network switching devices in scenarios with small forwarding traffic are solved, and the network switching efficiency is improved.

CN118869632BActive Publication Date: 2024-12-24ZIGUANG HENGYUE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411345659.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-26
Publication Date
2024-12-24
Estimated Expiration
2044-09-26

AI Technical Summary

Technical Problem

In the application scenarios where the forwarding traffic is small, the dedicated switching chips are costly and the probability of failure increases, making it difficult to exert high performance, resulting in waste of resources.

Method used

By canceling the dedicated switching chip, the interconnection interface of the central processor is directly connected to the first interconnection interface of the PHY chip, and the multiple second interconnection interfaces of the PHY chip are connected one by one to multiple network ports, and the central processor realizes the reporting The document switching function reduces hardware costs and failure probability and improves network switching efficiency.

Benefits of technology

It reduces the hardware cost and failure probability of network switching devices, maximizes the utilization of central processor resources, and improves the network switching efficiency of network switching devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118869632B_ABST
    Figure CN118869632B_ABST
Patent Text Reader

Abstract

The present application provides a network switching method, device, equipment and computer program product. The present application connects an interconnection interface of a central processing unit with a first interconnection interface of a PHY chip, connects multiple second interconnection interfaces of the PHY chip with multiple network ports in a one-to-one correspondence, and when the central processing unit receives a first data message sent by the PHY chip, adds the first data message to a received message storage space, and when the received message storage space is not empty, takes out a second data message that is not a local data message in the received message storage space and processes it into a third data message, adds the third data message to a sent message storage space, and when the sent message storage space is not empty, takes out a fourth data message to be sent in the sent message storage space, and sends the fourth data message to the outside from the destination network port corresponding to the fourth data message, thereby reducing the hardware cost and failure probability of a network switching device and improving the network switching efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network switching technology, and in particular to a network switching method, device, equipment and computer program product. Background Art

[0002] Network switching devices usually use the method of "CPU (Central Processing Unit) + switching chip + PHY (Physical Layer) chip switching out multiple network ports" to realize data exchange between multiple network ports.

[0003] This implementation requires the installation of a dedicated switching chip, which has the following defects: the dedicated switching chip is expensive, and the hardware circuits added with the dedicated switching chip will also increase the probability of failure; in application scenarios with small forwarding traffic, it is difficult to give full play to the high performance of the dedicated switching chip, resulting in a waste of resources. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a network switching method, apparatus, device and computer program product to achieve the technical effect of reducing the hardware cost and failure probability of network switching equipment while improving the network switching efficiency of the network switching equipment.

[0005] In a first aspect, an embodiment of the present application provides a network switching method, which is applied to a central processing unit, wherein an interconnection interface of the central processing unit is connected to a first interconnection interface of a physical layer PHY chip, and multiple second interconnection interfaces of the PHY chip are connected to multiple network ports in a one-to-one correspondence; the method comprises:

[0006] When receiving a first data message sent by the PHY chip, adding the first data message to a pre-constructed received message storage space; wherein the first data message is a data message sent from any one of the multiple network ports to the PHY chip;

[0007] When the received message storage space is not empty, taking out a second data message that is not a local data message from the received message storage space, generating a third data message according to the second data message, and adding the third data message to the pre-constructed sent message storage space;

[0008] When the sending message storage space is not empty, the fourth data message to be sent is taken out from the sending message storage space, and the fourth data message is sent externally from the destination network port corresponding to the fourth data message.

[0009] In the above implementation process, by connecting the interconnection interface of the central processing unit with the first interconnection interface of the PHY chip, and connecting multiple second interconnection interfaces of the PHY chip with multiple network ports in a one-to-one correspondence, the central processing unit, when receiving a first data packet sent from any network port via the PHY chip, adds the first data packet to the received message storage space, and when the received message storage space is not empty, takes out the second data packet that is not a local data packet in the received message storage space and processes it into a third data packet, and adds the third data packet to the sent message storage space, and when the sent message storage space is not empty, takes out the fourth data packet to be sent in the sent message storage space, and sends the fourth data packet to the outside from the destination network port corresponding to the fourth data packet, which can reduce the hardware cost and failure probability of the network switching equipment, and improve the network switching efficiency of the network switching equipment.

[0010] Further, the adding the first data message to a pre-constructed received message storage space includes:

[0011] Determining a target storage location in the received message storage space according to a reception time of the first data message;

[0012] The first data message is stored in a target storage location in the received message storage space.

[0013] In the above implementation process, the central processor determines the target storage position in the received message storage space according to the reception time of the first data message, and stores the first data message in the target storage position in the received message storage space, so that multiple received messages can be stored in the received storage space in an orderly manner.

[0014] Further, the taking out a second data message that is not a local data message from the received message storage space includes:

[0015] Determining a message receiving timing according to a plurality of received messages in the received message storage space;

[0016] According to the message receiving timing, traverse each received message in the received message storage space, and search for a local data message matching the current received message in a pre-stored local data message list;

[0017] When there is no local data message matching the currently received message in the local data message list, it is determined that the currently received message is the second data message, and the second data message is taken out from the received message storage space.

[0018] In the above implementation process, the central processing unit determines the message reception timing according to multiple received messages in the received message storage space, traverses each received message in the received message storage space according to the message reception timing, searches the local data message list for a local data message that matches the current received message, and when there is no local data message matching the current received message in the local data message list, determines that the current received message is the second data message, and takes out the second data message from the received message storage space, so that the second data message that is not a local data message can be quickly and accurately taken out from the received message storage space.

[0019] Further, the generating a third data message according to the second data message includes:

[0020] Determine a destination network port corresponding to the second data message according to the destination Internet Protocol IP address of the second data message;

[0021] Querying a pre-stored media access control MAC address table for a MAC address of a destination network port corresponding to the second data message;

[0022] The identification information of the destination network port corresponding to the second data message is added to the second data message, and the source MAC address of the second data message is modified to the MAC address of the destination network port corresponding to the second data message, so as to generate the third data message.

[0023] In the above implementation process, the central processor determines the destination network port corresponding to the second data packet according to the destination IP address of the second data packet, queries the MAC address of the destination network port corresponding to the second data packet in the MAC address table, adds the identification information of the destination network port corresponding to the second data packet to the second data packet, and modifies the source MAC address of the second data packet to the MAC address of the destination network port corresponding to the second data packet to generate a third data packet, thereby improving the network switching efficiency of the network switching equipment.

[0024] Further, the adding the third data message to the pre-built sending message storage space includes:

[0025] Determining a target storage location in the sending message storage space according to a generation time of the third data message;

[0026] The third data message is stored in a target storage location in the sending message storage space.

[0027] In the above implementation process, the central processor determines the target storage location in the sending message storage space according to the generation time of the third data message, and stores the third data message in the target storage location in the sending message storage space, so that multiple sending messages can be stored in the sending storage space in an orderly manner.

[0028] Further, the taking out the fourth data message to be sent from the sending message storage space includes:

[0029] Determining a message sending timing according to the multiple sent messages in the sent message storage space;

[0030] According to the message sending timing, each sending message in the sending message storage space is traversed, it is determined that the current sending message is the fourth data message, and the fourth data message is taken out from the sending message storage space.

[0031] In the above implementation process, the central processing unit determines the message sending timing according to multiple sending messages in the sending message storage space, traverses each sending message in the sending message storage space according to the message sending timing, determines that the current sending message is the fourth data message, and takes out the fourth data message from the sending message storage space. This can send multiple sending messages in the sending message storage space in sequence, avoid the problem of missed transmission or wrong transmission, and is conducive to further improving the network switching efficiency of the network switching equipment.

[0032] Further, sending the fourth data message externally from the destination network port corresponding to the fourth data message includes:

[0033] The fourth data message is sent to the MAC controller inside the central processing unit, so that the MAC controller sends the fourth data message externally from the destination network port corresponding to the fourth data message.

[0034] In the above implementation process, by configuring a MAC controller inside the central processing unit, the central processing unit sends the fourth data packet to the MAC controller inside the central processing unit, so that the MAC controller sends the fourth data packet to the outside from the destination network port corresponding to the fourth data packet, which can further improve the network switching efficiency of the network switching device.

[0035] Furthermore, the method further comprises:

[0036] When the received message storage space is not empty, a fifth data message which is a local data message is taken out from the received message storage space, and the fifth data message is sent to the application layer.

[0037] In the above implementation process, when the received message storage space is not empty, the central processing unit takes out the fifth data message which is a local data message from the received message storage space and sends the fifth data message to the application layer. The second data message which is not a local data message and the fifth data message which is a local data message in the received message storage space can be taken out at the same time, thereby ensuring that the fifth data message which is a local data message in the received message storage space is sent to the application layer in a timely manner.

[0038] Furthermore, the received message storage space includes a received message queue, and the sent message storage space includes a sent message queue.

[0039] In the above implementation process, by constructing a received message queue as a received message storage space and constructing a sent message queue as a sent message storage space, the data reading and writing efficiency of the central processor for the received message storage space and the sent message storage space can be effectively improved.

[0040] In a second aspect, an embodiment of the present application provides a network switching device, which is applied to a central processing unit, wherein an interconnection interface of the central processing unit is connected to a first interconnection interface of a physical layer PHY chip, and a plurality of second interconnection interfaces of the PHY chip are connected to a plurality of network ports in a one-to-one correspondence; the device comprises:

[0041] A message receiving module, configured to add a first data message sent by the PHY chip to a pre-constructed received message storage space when the first data message is received; wherein the first data message is a data message sent from any one of the multiple network ports to the PHY chip;

[0042] A message processing module, used for taking out a second data message that is not a local data message from the received message storage space when the received message storage space is not empty, generating a third data message according to the second data message, and adding the third data message to the pre-constructed sent message storage space;

[0043] The message sending module is used to take out the fourth data message to be sent from the sending message storage space when the sending message storage space is not empty, and send the fourth data message externally from the destination network port corresponding to the fourth data message.

[0044] In a third aspect, an embodiment of the present application provides a network switching device, including a central processing unit, a physical layer PHY chip, and multiple network ports; the interconnection interface of the central processing unit is connected to the first interconnection interface of the PHY chip, and the multiple second interconnection interfaces of the PHY chip are connected to the multiple network ports in a one-to-one correspondence; the central processing unit is used to:

[0045] When receiving a first data message sent by the PHY chip, adding the first data message to a pre-constructed received message storage space; wherein the first data message is a data message sent from any one of the multiple network ports to the PHY chip;

[0046] When the received message storage space is not empty, taking out a second data message that is not a local data message from the received message storage space, generating a third data message according to the second data message, and adding the third data message to the pre-constructed sent message storage space;

[0047] When the sending message storage space is not empty, the fourth data message to be sent is taken out from the sending message storage space, and the fourth data message is sent externally from the destination network port corresponding to the fourth data message.

[0048] In a fourth aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor; the memory is coupled to the processor, and the processor implements the method described above when executing the computer program.

[0049] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes instructions, and when the instructions are executed by a computer, the computer implements the method as described above.

[0050] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored computer program; wherein, when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the method described above. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0052] Figure 1 A flowchart of a network switching method provided in the first embodiment of the present application;

[0053] Figure 2 A schematic diagram of the structure of a network switching device exemplified in the first embodiment of the present application;

[0054] Figure 3A data flow diagram of a network switching method exemplified in the first embodiment of the present application;

[0055] Figure 4 A schematic diagram of the structure of a network switching device provided in the second embodiment of the present application;

[0056] Figure 5 A schematic diagram of the structure of a network switching device provided in the third embodiment of the present application;

[0057] Figure 6 A schematic structural diagram of an electronic device provided in the fourth embodiment of the present application. DETAILED DESCRIPTION

[0058] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0059] It should be noted that in the description of this application, the terms "first", "second", etc. are only used to distinguish descriptions and cannot be understood as indicating or implying relative importance. At the same time, the step numbers in the text are only for the convenience of explaining the embodiments of this application and do not serve to limit the order in which the steps are executed. The method provided in the embodiments of this application can be executed by relevant terminal devices, and the following description will be given by taking the central processor in the network switching device as the execution subject as an example.

[0060] In related technologies, network switching equipment usually uses methods such as "CPU (Central Processing Unit) + switching chip + PHY (Physical Layer) chip to switch out multiple network ports", "CPU directly out of network port" or "CPU directly out of high-speed network port + expansion card to decompose into multiple low-speed network ports" to achieve data exchange between multiple network ports.

[0061] For network switching devices responsible for network security testing, such as vulnerability scanning, the network bandwidth requirement is not high, but it is generally required to have multiple network ports to connect to multiple network segments to meet the application needs of scanning multiple intranet devices at the same time.

[0062] In this application scenario, the above three implementation methods of network switching equipment have the following defects:

[0063] 1. For the implementation of "CPU + switching chip + PHY chip to transfer to multiple network ports", this implementation requires the setting of a dedicated switching chip. Although the use of a dedicated switching chip can efficiently realize data exchange between multiple network ports, the cost of a dedicated switching chip is high. The hardware circuit added with the dedicated switching chip will also increase the probability of failure. In addition, in the application scenario with small forwarding traffic, it is difficult to give full play to the high performance of the dedicated switching chip, resulting in a waste of resources.

[0064] 2. Regarding the implementation of "CPU direct network port", since the number of direct network ports supported by the CPU is limited, the number of CPU direct network ports is very small.

[0065] 3. Regarding the implementation method of "CPU directly outputs high-speed network port + expansion card decomposes into multiple low-speed network ports", although multiple network ports can be transferred, additional expansion cards need to be developed, which will also increase the hardware cost and failure probability of network switching equipment.

[0066] To this end, the embodiment of the present application proposes a network switching method, by canceling the dedicated switching chip, directly connecting the interconnection interface of the central processing unit to the first interconnection interface of the PHY chip, connecting multiple second interconnection interfaces led out of the PHY chip to multiple network ports in a one-to-one correspondence, and migrating the message switching function of the dedicated switching chip to the central processing unit for implementation, and the PHY chip can be used to directly switch out multiple network ports, thereby reducing the hardware cost and failure probability of the network switching device, and by the central processing unit receiving the first data message sent from any network port through the PHY chip, the first data message is sent to the central processing unit. Add a received message storage space; when the received message storage space is not empty, take out a second data message that is not a local data message in the received message storage space, process it into a third data message, and add the third data message to the sent message storage space; when the sent message storage space is not empty, take out a fourth data message to be sent in the sent message storage space, and send the fourth data message to the outside from the destination network port corresponding to the fourth data message. This can maximize the use of central processing unit resources to decouple the execution of message receiving operations, message processing operations, and message sending operations, thereby improving the network switching efficiency of network switching equipment.

[0067] Please see Figure 1 , Figure 1 A flowchart of a network switching method provided in the first embodiment of the present application. The first embodiment of the present application provides a network switching method, which is applied to a central processing unit, wherein an interconnection interface of the central processing unit is connected to a first interconnection interface of a physical layer PHY chip, and multiple second interconnection interfaces of the PHY chip are connected to multiple network ports in a one-to-one correspondence; the method comprises steps S101 to S103:

[0068] S101. When receiving a first data message sent by a PHY chip, add the first data message to a pre-constructed received message storage space; wherein the first data message is a data message sent from any one of a plurality of network ports to the PHY chip;

[0069] S102: if the received message storage space is not empty, take out a second data message that is not a local data message from the received message storage space, generate a third data message according to the second data message, and add the third data message to the pre-constructed sent message storage space;

[0070] S103: When the sending message storage space is not empty, take out a fourth data message to be sent from the sending message storage space, and send the fourth data message externally from a destination network port corresponding to the fourth data message.

[0071] As an example, according to actual application requirements, a central processor, a PHY chip, and multiple network ports are selected, the interconnection interface of the central processor is connected to the first interconnection interface of the PHY chip, and multiple second interconnection interfaces of the PHY chip are connected to multiple network ports in a one-to-one correspondence to assemble a network switching device. Among them, each of the multiple network ports is used to connect an external device, such as an intranet device.

[0072] Since the MII interface (Medium Independent Interface) is usually used between the MAC (Medium Access Control) layer and the PHY layer of the network switching equipment, the types of MII interface include GMII interface (Gigabit Media Independent Interface), SGMII interface (Serial Gigabit Media Independent Interface), QSGMII interface (Quad Serial Gigabit Media Independent Interface), USGMII interface (Universal Serial Gigabit Media Independent Interface) and USXGMII interface (Universal Serial 10 Gigabit Media Independent Interface), so the MII interface can be used as the interconnection interface of the central processing unit and the interconnection interface of the PHY chip.

[0073] In a preferred implementation of this embodiment, the interconnection interface of the central processing unit includes at least one of a USXGMII interface, a QSGMII interface and a USGMII interface, and the first interconnection interface of the PHY chip includes at least one of a USXGMII interface, a QSGMII interface and a USGMII interface.

[0074] It should be noted that the interface types of a group of interconnected interfaces between the central processing unit and the PHY chip are the same. For example, the interconnection interface of the central processing unit is a USXGMII interface, a QSGMII interface, or a USGMII interface, and correspondingly, the first interconnection interface of the PHY chip connected to the interconnection interface of the central processing unit is a USXGMII interface, a QSGMII interface, or a USGMII interface.

[0075] In a preferred implementation of this embodiment, the second interconnection interface of the PHY chip includes an SGMII interface, and the multiple network ports include an RJ45 (Registered Jack 45, a type of information socket connector) network port.

[0076] After the network switching device is assembled, the network switching device is operated. For each of the multiple network ports, the network port can receive a data message sent by an external device connected to the network port to the PHY chip.

[0077] After receiving a data message, ie, a first data message, sent by an external device connected to the network port to the PHY chip, any network port among the multiple network ports sends the first data message to the PHY chip.

[0078] After receiving the first data message sent by the network port, the PHY chip sends the first data message to the central processing unit.

[0079] The central processing unit is pre-built with a received message storage space and a sent message storage space, wherein the received message storage space is used for centrally storing received messages, and the sent message storage space is used for centrally storing sent messages.

[0080] The central processor detects in real time whether a data message sent from any network port is received. When a first data message sent by the PHY chip is received, the first data message is added to the received message storage space. Thus, the first data message becomes a received message in the received message storage space.

[0081] The central processing unit detects in real time whether the received message storage space is empty. When the received message storage space is not empty, each received message in the received message storage space is traversed to determine whether the current received message is a local data message. If the current received message is not a local data message, it is determined that the current received message is the second data message, and the second data message is taken out from the received message storage space. A third data message is generated based on the second data message, and the third data message is added to the sent message storage space. At this point, the third data message becomes a sent message in the sent message storage space. When the received message storage space is empty, it is considered that there is no received message in the received message storage space, and the message processing operation is not performed.

[0082] The central processing unit detects in real time whether the transmission message storage space is empty. If the transmission message storage space is not empty, each transmission message in the transmission message storage space is traversed to determine whether the current transmission message is a data message to be sent. If the current transmission message is a data message to be sent, it is determined that the current transmission message is a fourth data message, and the fourth data message is taken out from the transmission message storage space. According to the fourth data message, the destination network port corresponding to the fourth data message is determined, and the fourth data message is sent externally from the destination network port corresponding to the fourth data message. It can be understood that the destination network port is a network port designated to send the fourth data message externally among multiple network ports.

[0083] By canceling the dedicated switching chip, directly connecting the interconnection interface of the central processing unit with the first interconnection interface of the PHY chip, connecting multiple second interconnection interfaces derived from the PHY chip with multiple network ports in a one-to-one correspondence, and migrating the message switching function of the dedicated switching chip to the central processing unit for implementation, the PHY chip can be used to directly switch out multiple network ports, thereby reducing the hardware cost and failure probability of the network switching device, and by the central processing unit, when receiving a first data message sent from any network port via the PHY chip, adding the first data message to the received message storage space, when the received message storage space is not empty, taking out the second data message that is not a local data message in the received message storage space and processing it into a third data message, adding the third data message to the sent message storage space, when the sent message storage space is not empty, taking out the fourth data message to be sent in the sent message storage space, and sending the fourth data message externally from the destination network port corresponding to the fourth data message, the resources of the central processing unit can be maximized to decouple the execution of message receiving operations, message processing operations, and message sending operations, thereby improving the network switching efficiency of the network switching device.

[0084] The embodiment of the present application connects the interconnection interface of the central processing unit with the first interconnection interface of the PHY chip, and connects multiple second interconnection interfaces of the PHY chip with multiple network ports in a one-to-one correspondence. When the central processing unit receives a first data packet sent from any network port via the PHY chip, the central processing unit adds the first data packet to the received message storage space, and when the received message storage space is not empty, takes out the second data packet that is not a local data packet in the received message storage space and processes it into a third data packet, and adds the third data packet to the sent message storage space. When the sent message storage space is not empty, the fourth data packet to be sent in the sent message storage space is taken out, and the fourth data packet is sent externally from the destination network port corresponding to the fourth data packet. This can reduce the hardware cost and failure probability of the network switching device, and improve the network switching efficiency of the network switching device.

[0085] In an optional embodiment, adding the first data message to a pre-constructed received message storage space includes: determining a target storage location in the received message storage space based on a reception time of the first data message; and storing the first data message in the target storage location in the received message storage space.

[0086] As an example, in order to store multiple received messages in an orderly manner in a received storage space, when the central processing unit receives a first data message sent by the PHY chip, it determines the target storage location in the received message storage space according to the reception time of the first data message, and stores the first data message in the target storage location in the received message storage space.

[0087] For example, assuming that the received message storage space is a received message queue, the central processing unit determines the target storage position in the received message queue for the first data message currently received according to the reception time of the first data message. Specifically, it can be: since the reception time of the first data message currently received is the latest compared to the first data message previously received, in order to give priority to the earliest received message in the received message queue, based on the first-in-first-out principle of the queue, it is determined that the target storage position in the received message queue is the tail of the received message queue, and the first data message is spliced ​​at the tail of the received message queue.

[0088] For another example, assuming that the received message storage space is a received message database, the central processing unit determines the target storage location in the received message database for the first data message currently received according to the receiving time of the first data message. Specifically, it may be: since the central processing unit may currently receive multiple first data messages at the same time, in order to uniformly store the multiple first data messages received in the same batch, multiple receiving time periods are pre-divided, and the received message database is divided into multiple partitions corresponding to the multiple receiving time periods, the receiving time period to which the receiving time of the first data message belongs is determined, and then it is determined that the target storage location in the received message database is the partition location corresponding to the receiving time period, and the first data message is stored in the partition location corresponding to the receiving time period.

[0089] In the embodiment of the present application, a central processor determines a target storage location in a received message storage space according to a reception time of a first data message, and stores the first data message in the target storage location in the received message storage space, thereby being able to orderly store multiple received messages in the received storage space.

[0090] In an optional embodiment, the taking out of the second data message that is not a local data message from the received message storage space includes: determining a message reception timing based on multiple received messages in the received message storage space; traversing each received message in the received message storage space according to the message reception timing, and searching a pre-stored local data message list for a local data message that matches the current received message; if there is no local data message matching the current received message in the local data message list, determining that the current received message is the second data message, and taking out the second data message from the received message storage space.

[0091] As an example, considering that the data message sent by the external device from the network port to the PHY chip may be a data message for managing the application layer of the network switching device, such as upgrading, or may be a data message for exchanging data between multiple network ports, the central processor pre-stores a local data message list, and the local data message list includes multiple local data messages. Among them, the local data message refers to a data message provided to the network switching device for local processing, such as a data message for upgrading the firmware of the network switching device.

[0092] When the received message storage space is not empty, the central processing unit determines the message reception timing based on the multiple received messages in the received message storage space, and traverses each received message in the received message storage space according to the message reception timing, for example, in the order of message reception time from early to late, and searches the local data message storage list for the local data message that matches the current received message, and determines whether there is a local data message in the local data message list that matches the current received message.

[0093] In actual applications, the message information of the currently received message can be compared with the message information of each local data message in the local data message storage list. If the message information of the currently received message is inconsistent with the message information of each local data message, it is determined that there is no local data message in the local data message list that matches the currently received message; if the message information of the currently received message is consistent with the message information of any local data message, it is determined that the local data message matches the currently received message, and there is a local data message in the local data message list that matches the currently received message.

[0094] When there is no local data message in the local data message list that matches the currently received message, it is considered that the currently received message is a data message used to exchange data between multiple network ports, and the currently received message is determined to be the second data message. The second data message is taken out from the received message storage space for subsequent processing.

[0095] When there is a local data message in the local data message list that matches the current received message, it is considered that the current received message is a data message used to upgrade the application layer of the network switching device and other management. At this time, continue to traverse the next received message in the received message storage space until multiple received messages in the received message storage space are traversed.

[0096] By traversing each received message in the received message storage space according to the message reception timing to retrieve the second data message that is not a local data message, the second data message that is received earliest and is not a local data message can be preferentially retrieved from the received message storage space.

[0097] The embodiment of the present application determines the message reception timing according to multiple received messages in the received message storage space by the central processing unit, traverses each received message in the received message storage space according to the message reception timing, searches for a local data message list that matches the current received message, and if there is no local data message matching the current received message in the local data message list, determines that the current received message is a second data message, and takes out the second data message from the received message storage space. The second data message that is not a local data message can be quickly and accurately taken out from the received message storage space.

[0098] In an optional embodiment, the generating of the third data packet based on the second data packet includes: determining the destination network port corresponding to the second data packet based on the destination Internet Protocol IP address of the second data packet; querying the MAC address of the destination network port corresponding to the second data packet in a pre-stored media access control MAC address table; adding identification information of the destination network port corresponding to the second data packet to the second data packet, and modifying the source MAC address of the second data packet to the MAC address of the destination network port corresponding to the second data packet, to generate the third data packet.

[0099] As an example, the central processor pre-stores a MAC address table, and the MAC address table includes the MAC address of each network port in the plurality of network ports.

[0100] After receiving the second data packet, the central processing unit parses the second data packet to obtain the destination IP address of the second data packet, determines the destination network port corresponding to the second data packet based on the destination IP address of the second data packet, queries the MAC address of the destination network port corresponding to the second data packet in the MAC address table, and determines the identification information of the destination network port corresponding to the second data packet, such as portID.

[0101] After obtaining the MAC address and identification information of the destination network port corresponding to the second data message, the central processing unit adds the identification information of the destination network port corresponding to the second data message to the second data message. Specifically, the identification information of the destination network port corresponding to the second data message can be added to the message header of the second data message, and the source MAC address of the second data message is modified to the MAC address of the destination network port corresponding to the second data message to generate a third data message.

[0102] By adding the identification information of the destination network port corresponding to the second data message to the second data message, modifying the source MAC address of the second data message to the MAC address of the destination network port corresponding to the second data message, generating a third data message and adding the third data message to the sending message storage space, the received message can be first processed into a sending message and then stored in the sending message storage space, so as to facilitate the subsequent retrieval of the fourth data message to be sent from the sending message storage space and then directly execute the message sending operation, thereby improving the network switching efficiency of the network switching equipment.

[0103] In the embodiment of the present application, a central processor determines the destination network port corresponding to the second data packet according to the destination IP address of the second data packet, queries the MAC address of the destination network port corresponding to the second data packet in the MAC address table, adds identification information of the destination network port corresponding to the second data packet to the second data packet, and modifies the source MAC address of the second data packet to the MAC address of the destination network port corresponding to the second data packet, so as to generate a third data packet, thereby improving the network switching efficiency of the network switching device.

[0104] In an optional embodiment, adding the third data message to the pre-constructed sending message storage space includes: determining a target storage location in the sending message storage space based on a generation time of the third data message; and storing the third data message in the target storage location in the sending message storage space.

[0105] As an example, in order to store multiple sending messages in order in the sending storage space, after obtaining the third data message, the central processing unit determines the target storage location in the sending message storage space according to the generation time of the third data message, and stores the third data message in the target storage location in the sending message storage space.

[0106] For example, assuming that the sending message storage space is a sending message queue, the central processing unit determines the target storage position in the sending message queue for the third data message currently generated according to the generation time of the third data message. Specifically, it can be: since the generation time of the third data message currently generated is the latest compared to the third data message previously generated, in order to give priority to the earliest generated sending message in the sending message queue, based on the first-in-first-out principle of the queue, it is determined that the target storage position in the sending message queue is the tail of the sending message queue, and the third data message is spliced ​​at the tail of the sending message queue.

[0107] For another example, assuming that the sending message storage space is a sending message database, the central processing unit determines the target storage location in the sending message database for the third data message currently being generated according to the generation time of the third data message. Specifically, it may be: since the central processing unit may currently generate multiple third data messages at the same time, in order to uniformly store multiple third data messages generated in the same batch, multiple generation time periods are pre-divided, and the sending message database is divided into multiple partitions corresponding to the multiple generation time periods. The generation time period to which the generation time of the third data message belongs is determined, and then it is determined that the target storage location in the sending message database is the partition location corresponding to the generation time period, and the third data message is stored in the partition location corresponding to the generation time period.

[0108] In the embodiment of the present application, the central processor determines the target storage location in the sending message storage space according to the generation time of the third data message, and stores the third data message in the target storage location in the sending message storage space, so that multiple sending messages can be stored in the sending storage space in an orderly manner.

[0109] In an optional embodiment, the taking out the fourth data message to be sent from the sending message storage space includes: determining the message sending timing based on multiple sending messages in the sending message storage space; traversing each sending message in the sending message storage space according to the message sending timing, determining that the current sending message is the fourth data message, and taking out the fourth data message from the sending message storage space.

[0110] As an example, when the sending message storage space is not empty, the central processing unit determines the message sending timing based on multiple sending messages in the sending message storage space, and traverses each sending message in the sending message storage space according to the message sending timing, for example, in order of message generation time from early to late, determines that the current sending message is the fourth data message, and takes out the fourth data message from the sending message storage space.

[0111] In the embodiment of the present application, a central processing unit determines a message sending timing according to multiple sending messages in a sending message storage space, traverses each sending message in the sending message storage space according to the message sending timing, determines that the current sending message is the fourth data message, and takes out the fourth data message from the sending message storage space. This can sequentially send multiple sending messages in the sending message storage space, avoid the problem of missed or mis-sent messages, and is beneficial to further improving the network switching efficiency of the network switching equipment.

[0112] In an optional embodiment, sending the fourth data packet externally from the destination network port corresponding to the fourth data packet includes: sending the fourth data packet to a MAC controller inside the central processing unit, so that the MAC controller sends the fourth data packet externally from the destination network port corresponding to the fourth data packet.

[0113] As an example, since the MAC layer of the network switching device can be divided into a MAC communication protocol in software and a MAC controller in hardware, in addition to configuring a network port driver inside the central processing unit to execute the network switching method, such as DPDK (Data Plane Development Kit, a high-performance network driver component), a MAC controller can also be configured inside the central processing unit to perform message transmission operations on the physical link.

[0114] After receiving the fourth data message, the central processor sends the fourth data message to the MAC controller inside the central processor, and the MAC controller sends the fourth data message to the PHY chip, so that the PHY chip sends the fourth data message externally from the destination network port corresponding to the fourth data message.

[0115] The embodiment of the present application configures a MAC controller inside the central processing unit, and the central processing unit sends a fourth data message to the MAC controller inside the central processing unit, so that the MAC controller sends the fourth data message to the outside from the destination network port corresponding to the fourth data message, thereby further improving the network switching efficiency of the network switching device.

[0116] In an optional embodiment, the method further includes step S104:

[0117] S104. When the received message storage space is not empty, take out a fifth data message that is a local data message from the received message storage space, and send the fifth data message to the application layer.

[0118] As an example, when the received message storage space is not empty, the central processing unit traverses each received message in the received message storage space to determine whether the current received message is a local data message; if the current received message is not a local data message, it determines that the current received message is the second data message, takes out the second data message from the received message storage space, generates a third data message based on the second data message, and adds the third data message to the sent message storage space, so that the third data message becomes a sent message in the sent message storage space; if the current received message is a local data message, it determines that the current received message is the fifth data message, takes out the fifth data message from the received message storage space, and sends the fifth data message to the application layer, so that the application layer can make corresponding processing according to the fifth data message in time.

[0119] In the embodiment of the present application, when the received message storage space is not empty, the central processing unit takes out the fifth data message which is a local data message from the received message storage space and sends the fifth data message to the application layer. The second data message which is not a local data message and the fifth data message which is a local data message in the received message storage space can be taken out at the same time, thereby ensuring that the fifth data message which is a local data message in the received message storage space is sent to the application layer in a timely manner.

[0120] In an optional embodiment, the received message storage space includes a received message queue, and the sent message storage space includes a sent message queue.

[0121] As an exemplary embodiment, a data structure of a queue is adopted, a received message queue is pre-built as a received message storage space, and a sent message queue is pre-built as a sent message storage space.

[0122] By constructing a received message queue as a received message storage space, the first data message can be quickly added to the received message storage space by directly splicing the received messages in the received message queue, and the second data message can be quickly taken out from the received message storage space by directly cutting the received messages in the received message queue, thereby reducing the data movement process of traditional methods and improving the data reading and writing efficiency of the central processing unit to the received message storage space.

[0123] Similarly, by constructing a sending message queue as a sending message storage space, the third data message can be quickly added to the sending message storage space by directly splicing the sending messages in the sending message queue, and the fourth data message can be quickly taken out from the sending message storage space by directly cutting the sending messages in the sending message queue, thereby reducing the data movement process of the traditional method and improving the data reading and writing efficiency of the central processing unit to the sending message storage space.

[0124] The embodiment of the present application constructs a receive message queue as a receive message storage space and constructs a send message queue as a send message storage space, which can effectively improve the data reading and writing efficiency of the central processor for the receive message storage space and the send message storage space.

[0125] In order to more clearly illustrate a network switching method provided by the first embodiment of the present application, the following is designed: Figure 2 The network switching device shown in FIG. 1 is used to apply the network switching method to the network switching device. The flow chart of the network switching method is as follows: Figure 3 shown.

[0126] Please see Figure 4 , Figure 4 A schematic diagram of the structure of a network switching device provided for the second embodiment of the present application. The second embodiment of the present application provides a network switching device, which is applied to a central processing unit, wherein the interconnection interface of the central processing unit is connected to the first interconnection interface of the physical layer PHY chip, and the multiple second interconnection interfaces of the PHY chip are connected to the multiple network ports in a one-to-one correspondence, and the device includes: a message receiving module 201, which is used to add the first data message to a pre-constructed receiving message storage space when receiving the first data message sent by the PHY chip; wherein the first data message is a data message sent from any one of the multiple network ports to the PHY chip; a message processing module 202, which is used to take out a second data message that is not a local data message from the receiving message storage space when the receiving message storage space is not empty, and generate a third data message according to the second data message, and add the third data message to the pre-constructed sending message storage space; a message sending module 203, which is used to take out a fourth data message to be sent from the sending message storage space when the sending message storage space is not empty, and send the fourth data message to the outside from the destination network port corresponding to the fourth data message.

[0127] In an optional embodiment, adding the first data message to a pre-constructed received message storage space includes: determining a target storage location in the received message storage space based on a reception time of the first data message; and storing the first data message in the target storage location in the received message storage space.

[0128] In an optional embodiment, the taking out of the second data message that is not a local data message from the received message storage space includes: determining a message reception timing based on multiple received messages in the received message storage space; traversing each received message in the received message storage space according to the message reception timing, and searching a pre-stored local data message list for a local data message that matches the current received message; if there is no local data message matching the current received message in the local data message list, determining that the current received message is the second data message, and taking out the second data message from the received message storage space.

[0129] In an optional embodiment, the generating of the third data packet based on the second data packet includes: determining the destination network port corresponding to the second data packet based on the destination Internet Protocol IP address of the second data packet; querying the MAC address of the destination network port corresponding to the second data packet in a pre-stored media access control MAC address table; adding identification information of the destination network port corresponding to the second data packet to the second data packet, and modifying the source MAC address of the second data packet to the MAC address of the destination network port corresponding to the second data packet, to generate the third data packet.

[0130] In an optional embodiment, adding the third data message to the pre-constructed sending message storage space includes: determining a target storage location in the sending message storage space based on a generation time of the third data message; and storing the third data message in the target storage location in the sending message storage space.

[0131] In an optional embodiment, the taking out the fourth data message to be sent from the sending message storage space includes: determining the message sending timing based on multiple sending messages in the sending message storage space; traversing each sending message in the sending message storage space according to the message sending timing, determining that the current sending message is the fourth data message, and taking out the fourth data message from the sending message storage space.

[0132] In an optional embodiment, sending the fourth data packet externally from the destination network port corresponding to the fourth data packet includes: sending the fourth data packet to a MAC controller inside the central processing unit, so that the MAC controller sends the fourth data packet externally from the destination network port corresponding to the fourth data packet.

[0133] In an optional embodiment, the message processing module 202 is further used to: when the received message storage space is not empty, take out a fifth data message that is a local data message from the received message storage space, and send the fifth data message to the application layer.

[0134] In an optional embodiment, the received message storage space includes a received message queue, and the sent message storage space includes a sent message queue.

[0135] The implementation process of the functions and effects of each module in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, which will not be repeated here.

[0136] Please see Figure 5 , Figure 5 A schematic diagram of the structure of a network switching device provided for the third embodiment of the present application. The third embodiment of the present application provides a network switching device, including a central processor 301, a physical layer PHY chip 302, and multiple network ports 303; the interconnection interface of the central processor 301 is connected to the first interconnection interface of the PHY chip 302, and the multiple second interconnection interfaces of the PHY chip 302 are connected to the multiple network ports 303 in a one-to-one correspondence; the central processor 301 is used to: when receiving a first data message sent by the PHY chip 302, add the first data message to a pre-constructed received message storage space; wherein the first data message is received from multiple The method comprises: receiving a data message sent by any network port 303 of the network ports 303 to the PHY chip 302; when the received message storage space is not empty, taking out a second data message that is not a local data message from the received message storage space, generating a third data message based on the second data message, and adding the third data message to the pre-constructed sent message storage space; when the sent message storage space is not empty, taking out a fourth data message to be sent from the sent message storage space, and sending the fourth data message to the outside from the destination network port 303 corresponding to the fourth data message. In an optional embodiment, the adding of the first data message to the pre-constructed received message storage space includes: determining a target storage location in the received message storage space according to the reception time of the first data message; and storing the first data message in the target storage location in the received message storage space.

[0137] In an optional embodiment, the taking out of the second data message that is not a local data message from the received message storage space includes: determining a message reception timing based on multiple received messages in the received message storage space; traversing each received message in the received message storage space according to the message reception timing, and searching a pre-stored local data message list for a local data message that matches the current received message; if there is no local data message matching the current received message in the local data message list, determining that the current received message is the second data message, and taking out the second data message from the received message storage space.

[0138] In an optional embodiment, the generating of the third data packet based on the second data packet includes: determining the destination network port 303 corresponding to the second data packet based on the destination Internet Protocol IP address of the second data packet; querying the MAC address of the destination network port 303 corresponding to the second data packet in a pre-stored media access control MAC address table; adding identification information of the destination network port 303 corresponding to the second data packet to the second data packet, and modifying the source MAC address of the second data packet to the MAC address of the destination network port 303 corresponding to the second data packet, to generate a third data packet.

[0139] In an optional embodiment, adding the third data message to the pre-constructed sending message storage space includes: determining a target storage location in the sending message storage space based on a generation time of the third data message; and storing the third data message in the target storage location in the sending message storage space.

[0140] In an optional embodiment, the taking out the fourth data message to be sent from the sending message storage space includes: determining the message sending timing based on multiple sending messages in the sending message storage space; traversing each sending message in the sending message storage space according to the message sending timing, determining that the current sending message is the fourth data message, and taking out the fourth data message from the sending message storage space.

[0141] In an optional embodiment, sending the fourth data packet from the destination network port 303 corresponding to the fourth data packet includes: sending the fourth data packet to the MAC controller inside the central processor 301, so that the MAC controller sends the fourth data packet from the destination network port 303 corresponding to the fourth data packet.

[0142] In an optional embodiment, the central processor 301 is further used to: when the received message storage space is not empty, take out a fifth data message which is a local data message from the received message storage space, and send the fifth data message to the application layer.

[0143] In an optional embodiment, the received message storage space includes a received message queue, and the sent message storage space includes a sent message queue.

[0144] The implementation process of the functions and effects of the central processor 301, the PHY chip 302 and the multiple network ports 303 in the above-mentioned device is specifically described in the implementation process of the corresponding steps in the above-mentioned method, which will not be repeated here.

[0145] Please see Figure 6 , Figure 6The fourth embodiment of the present application provides an electronic device 40, comprising a processor 401, a memory 402, and a computer program stored in the memory 402 and configured to be executed by the processor 401; the memory 402 is coupled to the processor 401, and when the processor 401 executes the computer program, the method described in the first embodiment of the present application is implemented, and the same beneficial effects can be achieved.

[0146] When the processor 401 reads the computer program from the memory 402 through the bus 403 and executes the computer program, the method of any embodiment included in the method described in the first embodiment of the present application can be implemented.

[0147] Processor 401 can process digital signals and can include various computing structures, such as complex instruction set computer structure, reduced instruction set computer structure, or a structure that implements a combination of multiple instruction sets. In some examples, processor 401 can be a microprocessor.

[0148] The memory 402 may be used to store instructions executed by the processor 401 or data related to the execution of instructions. These instructions and / or data may include codes for implementing some or all functions of one or more modules described in the embodiments of the present application. The processor 401 of the disclosed embodiment may be used to execute instructions in the memory 402 to implement the method described in the first embodiment of the present application. The memory 402 includes a dynamic random access memory, a static random access memory, a flash memory, an optical memory, or other memory known to those skilled in the art.

[0149] The fifth embodiment of the present application provides a computer-readable storage medium, which includes a stored computer program; wherein, when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the method described in the first embodiment of the present application, and can achieve the same beneficial effects as the method.

[0150] In summary, the embodiments of the present application provide a network switching method, device, equipment and computer program product. The network switching method is applied to a central processing unit, the interconnection interface of the central processing unit is connected to the first interconnection interface of the physical layer PHY chip, and the multiple second interconnection interfaces of the PHY chip are connected to multiple network ports in a one-to-one correspondence; the method includes: when receiving a first data message sent by the PHY chip, adding the first data message to a pre-constructed receiving message storage space; wherein the first data message is a data message sent from any one of the multiple network ports to the PHY chip; when the receiving message storage space is not empty, taking out a second data message that is not a local data message from the receiving message storage space, generating a third data message based on the second data message, and adding the third data message to the pre-constructed sending message storage space; when the sending message storage space is not empty, taking out a fourth data message to be sent from the sending message storage space, and sending the fourth data message to the outside from the destination network port corresponding to the fourth data message. The embodiment of the present application connects the interconnection interface of the central processing unit with the first interconnection interface of the PHY chip, and connects multiple second interconnection interfaces of the PHY chip with multiple network ports in a one-to-one correspondence. When the central processing unit receives a first data packet sent from any network port via the PHY chip, the central processing unit adds the first data packet to the received message storage space, and when the received message storage space is not empty, takes out the second data packet that is not a local data packet in the received message storage space and processes it into a third data packet, and adds the third data packet to the sent message storage space. When the sent message storage space is not empty, the fourth data packet to be sent in the sent message storage space is taken out, and the fourth data packet is sent externally from the destination network port corresponding to the fourth data packet. This can reduce the hardware cost and failure probability of the network switching device, and improve the network switching efficiency of the network switching device.

[0151] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0152] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0153] If the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program codes.

[0154] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A network switching method, characterized in that: Applied to a central processing unit, the interconnection interface of the central processing unit is connected to the first interconnection interface of a physical layer PHY chip, and the multiple second interconnection interfaces of the PHY chip are connected to the multiple network ports in a one-to-one correspondence; the method comprises: When receiving a first data message sent by the PHY chip, adding the first data message to a pre-constructed received message storage space; wherein the first data message is a data message sent from any one of the multiple network ports to the PHY chip; The adding the first data message to a pre-constructed received message storage space includes: Determining a target storage location in the received message storage space according to a reception time of the first data message; storing the first data message at a target storage location in the received message storage space; When the received message storage space is not empty, taking out a second data message that is not a local data message from the received message storage space, generating a third data message according to the second data message, and adding the third data message to the pre-constructed sent message storage space; The taking out the second data message which is not a local data message from the received message storage space comprises: Determining a message receiving timing according to a plurality of received messages in the received message storage space; According to the message receiving timing, traverse each received message in the received message storage space, and search for a local data message matching the current received message in a pre-stored local data message list; If there is no local data message matching the currently received message in the local data message list, determining that the currently received message is the second data message, and taking out the second data message from the received message storage space; The generating a third data message according to the second data message comprises: Determine a destination network port corresponding to the second data message according to the destination Internet Protocol IP address of the second data message; Querying a pre-stored media access control MAC address table for a MAC address of a destination network port corresponding to the second data message; adding identification information of the destination network port corresponding to the second data message to the second data message, and modifying the source MAC address of the second data message to the MAC address of the destination network port corresponding to the second data message, to generate the third data message; The adding the third data message to the pre-constructed sending message storage space comprises: Determining a target storage location in the sending message storage space according to a generation time of the third data message; storing the third data message at a target storage location in the sending message storage space; When the sending message storage space is not empty, taking out the fourth data message to be sent from the sending message storage space, and sending the fourth data message externally from the destination network port corresponding to the fourth data message; The taking out the fourth data message to be sent from the sending message storage space includes: Determining a message sending timing according to the multiple sent messages in the sent message storage space; According to the message sending timing, each sending message in the sending message storage space is traversed, it is determined that the current sending message is the fourth data message, and the fourth data message is taken out from the sending message storage space.

2. The method according to claim 1, characterized in that The sending the fourth data message externally from the destination network port corresponding to the fourth data message includes: The fourth data message is sent to the MAC controller inside the central processing unit, so that the MAC controller sends the fourth data message externally from the destination network port corresponding to the fourth data message.

3. The method according to claim 1 or 2, characterized in that: The method further comprises: When the received message storage space is not empty, a fifth data message which is a local data message is taken out from the received message storage space, and the fifth data message is sent to the application layer.

4. The method according to claim 1 or 2, characterized in that: The received message storage space includes a received message queue, and the sent message storage space includes a sent message queue.

5. A network switching device, characterized in that: Applied to a central processing unit, the interconnection interface of the central processing unit is connected to the first interconnection interface of a physical layer PHY chip, and the multiple second interconnection interfaces of the PHY chip are connected to the multiple network ports in a one-to-one correspondence; the device comprises: A message receiving module, configured to add a first data message sent by the PHY chip to a pre-constructed received message storage space when the first data message is received; wherein the first data message is a data message sent from any one of the multiple network ports to the PHY chip; The adding the first data message to a pre-constructed received message storage space includes: Determining a target storage location in the received message storage space according to a reception time of the first data message; storing the first data message at a target storage location in the received message storage space; A message processing module, used for taking out a second data message that is not a local data message from the received message storage space when the received message storage space is not empty, generating a third data message according to the second data message, and adding the third data message to the pre-constructed sent message storage space; The taking out the second data message which is not a local data message from the received message storage space comprises: Determining a message receiving timing according to a plurality of received messages in the received message storage space; According to the message receiving timing, traverse each received message in the received message storage space, and search for a local data message matching the current received message in a pre-stored local data message list; If there is no local data message matching the currently received message in the local data message list, determining that the currently received message is the second data message, and taking out the second data message from the received message storage space; The generating a third data message according to the second data message comprises: Determine a destination network port corresponding to the second data message according to the destination Internet Protocol IP address of the second data message; Querying a pre-stored media access control MAC address table for a MAC address of a destination network port corresponding to the second data message; adding identification information of the destination network port corresponding to the second data message to the second data message, and modifying the source MAC address of the second data message to the MAC address of the destination network port corresponding to the second data message, to generate the third data message; The adding the third data message to the pre-constructed sending message storage space comprises: Determining a target storage location in the sending message storage space according to a generation time of the third data message; storing the third data message at a target storage location in the sending message storage space; A message sending module, used for taking out a fourth data message to be sent from the sending message storage space when the sending message storage space is not empty, and sending the fourth data message externally from a destination network port corresponding to the fourth data message; The taking out the fourth data message to be sent from the sending message storage space includes: Determining a message sending timing according to the multiple sent messages in the sent message storage space; According to the message sending timing, each sending message in the sending message storage space is traversed, it is determined that the current sending message is the fourth data message, and the fourth data message is taken out from the sending message storage space.

6. A network switching device, characterized in that: The system comprises a central processing unit, a physical layer PHY chip and a plurality of network ports; the interconnection interface of the central processing unit is connected to the first interconnection interface of the PHY chip, and the plurality of second interconnection interfaces of the PHY chip are connected to the plurality of network ports in a one-to-one correspondence; the central processing unit is used to: When receiving a first data message sent by the PHY chip, adding the first data message to a pre-constructed received message storage space; wherein the first data message is a data message sent from any one of the multiple network ports to the PHY chip; The adding the first data message to a pre-constructed received message storage space includes: Determining a target storage location in the received message storage space according to a reception time of the first data message; storing the first data message at a target storage location in the received message storage space; When the received message storage space is not empty, taking out a second data message that is not a local data message from the received message storage space, generating a third data message according to the second data message, and adding the third data message to the pre-constructed sent message storage space; The taking out the second data message which is not a local data message from the received message storage space comprises: Determining a message receiving timing according to a plurality of received messages in the received message storage space; According to the message receiving timing, traverse each received message in the received message storage space, and search for a local data message matching the current received message in a pre-stored local data message list; If there is no local data message matching the currently received message in the local data message list, determining that the currently received message is the second data message, and taking out the second data message from the received message storage space; The generating a third data message according to the second data message comprises: Determine a destination network port corresponding to the second data message according to the destination Internet Protocol IP address of the second data message; Querying a pre-stored media access control MAC address table for a MAC address of a destination network port corresponding to the second data message; adding identification information of the destination network port corresponding to the second data message to the second data message, and modifying the source MAC address of the second data message to the MAC address of the destination network port corresponding to the second data message, to generate the third data message; The adding the third data message to the pre-constructed sending message storage space comprises: Determining a target storage location in the sending message storage space according to a generation time of the third data message; storing the third data message at a target storage location in the sending message storage space; When the sending message storage space is not empty, taking out the fourth data message to be sent from the sending message storage space, and sending the fourth data message externally from the destination network port corresponding to the fourth data message; The taking out the fourth data message to be sent from the sending message storage space includes: Determining a message sending timing according to the multiple sent messages in the sent message storage space; According to the message sending timing, each sending message in the sending message storage space is traversed, it is determined that the current sending message is the fourth data message, and the fourth data message is taken out from the sending message storage space.

7. A computer program product, characterized in that The computer program product comprises instructions which, when executed by a computer, cause the computer to implement the method according to any one of claims 1 to 4.