Message forwarding method and device, storage medium and electronic device

By introducing controllers and multiple switches into the switch, filtering appropriate switches for message forwarding according to the switch's service load situation, solving the problem of low message forwarding efficiency in the prior art, and achieving efficient resource utilization and load balancing.

CN119676189APending Publication Date: 2025-03-21SUZHOU CENTEC COMM CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411941679.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

In the prior art, the forwarding efficiency of packets is low, resulting in high load pressure on the switching chip and serious waste of resources.

Method used

By introducing a controller and multiple switches into the switch, the controller receives the target message and message information sent by the switch, and filters out appropriate switches for forwarding operations based on the switch's service load situation, avoiding the single switch from taking on too many tasks.

Benefits of technology

It improves the efficiency of forwarding packets, avoids the waste of switch resources, and ensures load balancing of each switch.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119676189A_ABST
    Figure CN119676189A_ABST
Patent Text Reader

Abstract

The invention discloses a message forwarding method and device, a storage medium and an electronic device, a switch comprises a controller and a plurality of exchangers, the controller is connected with each exchanger, the exchangers are used for transmitting message data between network devices, and the method is applied to the controller. The method comprises: receiving a target message and message information of the target message sent by a first switch in a plurality of switches, the message information being used for indicating a forwarding mode of the target message, and the target message being a to-be-forwarded message received by the first switch; screening out a second exchanger from the plurality of exchangers according to the exchanger information and the message information of each exchanger, the exchanger information being used for indicating the current message forwarding service load condition of the exchanger; and controlling the second switch to execute a forwarding operation corresponding to the message information on the target message. By adopting the technical scheme, the problems of low message forwarding efficiency and the like in related technologies are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of communications, and in particular to a message forwarding method and device, a storage medium, and an electronic device. Background Art

[0002] The switch chip is provided with a message inbound processing engine and a message outbound processing engine, and the two engines cooperate to complete the forwarding of messages sent to the switch chip. Currently, all forwarding processing operations for messages are implemented by a switch chip, which has a large load pressure and poor message forwarding efficiency.

[0003] With regard to the problems such as poor forwarding efficiency of messages in related technologies, no effective solution has been proposed yet. Summary of the invention

[0004] The embodiments of the present application provide a message forwarding method and device, a storage medium and an electronic device, so as to at least solve the problem of poor message forwarding efficiency in the related art.

[0005] According to an embodiment of the present application, a method for forwarding a message is provided, wherein the switch includes a controller and a plurality of switches, wherein the controller is connected to each of the switches respectively, and the switches are used to transmit message data between network devices, and the method is applied to the controller, and the method includes:

[0006] receiving a target message and message information of the target message sent by a first switch among the plurality of switches, wherein the message information is used to indicate a forwarding mode of the target message, and the target message is a message to be forwarded received by the first switch;

[0007] Filtering out a second switch from the plurality of switches according to the switch information and the message information of each switch, wherein the switch information is used to indicate the current message forwarding service load of the switch;

[0008] The second switch is controlled to perform a forwarding operation corresponding to the message information on the target message.

[0009] Optionally, selecting a second switch from the multiple switches based on the switch information and the message information of each switch includes: detecting prediction information of each switch based on the message information and the switch information, wherein the prediction information is used to indicate a message forwarding service load status after the switch currently undertakes the forwarding operation task of the target message; and selecting the second switch from the multiple switches based on the switch information and the prediction information.

[0010] Optionally, the selecting the second switch from the plurality of switches according to the switch information and the prediction information comprises: extracting the switch with the smallest switch parameter from the plurality of switches according to the switch parameter of each switch to obtain a reference switch, wherein the switch parameter is used to indicate the data volume of the message to be processed by the switch, and the switch information comprises the switch parameter; detecting the size relationship between the switch parameter of the reference switch and the message threshold of the reference switch; and selecting the first switch when it is detected that the switch parameter of the reference switch is less than or equal to the message threshold. The switch is determined as the second switch; when it is detected that the switch parameter of the reference switch is greater than the message threshold, the size relationship between the prediction parameter of the reference switch and the message threshold is detected, wherein the prediction parameter is used to indicate the data volume of the message to be processed after the reference switch currently undertakes the forwarding operation task, and the prediction information includes the prediction parameter; when it is detected that the prediction parameter is greater than or equal to the message threshold, the reference switch is determined as the second switch; when it is detected that the prediction parameter is less than the message threshold, the first switch is determined as the second switch.

[0011] Optionally, the method further includes: detecting whether the information refresh opportunity has arrived; and when it is detected that the information refresh opportunity has arrived, refreshing the switch information of each switch according to the capability information of each switch, wherein the capability information is used to indicate the status of the messages that the switch can forward and process within the time period from the moment when the last refresh opportunity arrived to the moment when the current refresh opportunity arrives.

[0012] Optionally, refreshing the switch information of each of the switches according to the capability information of each of the switches includes: detecting the size relationship between the operating parameters and refresh parameters of each of the switches, wherein the operating parameters are used to indicate the data volume of the messages to be processed by the switch, and the refresh parameters are used to indicate the data volume of the messages that can be forwarded and processed by the switch within the time period, the capability information includes the refresh parameters, and the switch information includes the operating parameters; when it is detected that the operating parameters are greater than or equal to the refresh parameters, calculating the difference between the operating parameters and the refresh parameters to obtain a first refresh value; refreshing the switch information using the operating parameters replaced by the first refresh value; when it is detected that the operating parameters are less than the refresh parameters, determining the second refresh value to be 0; and refreshing the switch information using the operating parameters replaced by the second refresh value.

[0013] Optionally, the switch includes a first engine and a second engine, the first engine is connected to the second engine, the first engine and the second engine are both connected to the controller, the first engine is used to receive a first message to be processed and parse the first message to obtain first information indicating a forwarding mode of the first message and send the first message and the first information to the controller, the second engine is used to receive a second message to be processed sent by the controller and forward the second message according to the second information of the second message indicating a forwarding mode of the second message, before filtering out the second switch from the plurality of switches according to the switch information and the message information of each switch, the method further includes: receiving a first parameter sent by the first engine and a second parameter sent by the second engine, wherein the first engine is configured to send the first parameter to the controller when receiving the first message, the first parameter is used to indicate a message data volume of the first message, the first information includes the first parameter, the second engine is configured to send the second parameter to the controller when receiving the second message, the second parameter is used to indicate a message data volume of the second message, and the second information includes the second parameter; and updating the switch information according to the first parameter and the second parameter.

[0014] Optionally, the second switch includes a third engine and a fourth engine, the third engine is connected to the fourth engine, and the third engine and the fourth engine are both connected to the controller; the controlling the second switch to perform a forwarding operation corresponding to the message information on the target message includes: detecting a forwarding requirement of the target message according to the message information, wherein the forwarding requirement is used to indicate whether the target message needs to be looped back; when it is detected that the forwarding requirement is used to indicate that the target message needs to be looped back, sending a first instruction to the fourth engine, wherein the first instruction is used to instruct the fourth engine to forward the received target message to the third engine, and the third engine is used to forward the target message to the controller when the target message is received; when it is detected that the forwarding requirement is used to indicate that the target message does not need to be looped back, sending a second instruction to the fourth engine, wherein the second instruction is used to instruct the fourth engine to forward the received target message to a next-hop device connected to the switch.

[0015] According to another embodiment of the embodiment of the present application, a message forwarding device is further provided, the switch includes a controller and a plurality of switches, the controller is respectively connected to each of the switches, the switches are used to transmit message data between network devices, the device is applied to the controller, and the device includes:

[0016] A first receiving module, used for receiving a target message and message information of the target message sent by a first switch among the plurality of switches, wherein the message information is used for indicating a forwarding mode of the target message, and the target message is a message to be forwarded received by the first switch;

[0017] A screening module, used for screening out a second switch from the plurality of switches according to the switch information and the message information of each switch, wherein the switch information is used for indicating the current message forwarding service load of the switch;

[0018] The control module is used to control the second switch to perform a forwarding operation corresponding to the message information on the target message.

[0019] According to another aspect of the embodiments of the present application, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned message forwarding method when running.

[0020] According to another aspect of an embodiment of the present application, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the message forwarding method through the computer program.

[0021] In an embodiment of the present application, the switch includes a controller and multiple switches, the controller is connected to each switch respectively, the switch is used to transmit message data between network devices, the controller receives the target message to be forwarded and the message information for indicating the forwarding mode of the target message sent by the first switch among the multiple switches, and then selects the second switch from the multiple switches according to the switch information and message information for indicating the current message forwarding service load of the switch, and controls the second switch to perform the forwarding operation corresponding to the message information on the target message, that is, the controller will select the appropriate second switch to complete the forwarding operation of the target message according to the current message forwarding service load of each switch and the forwarding mode of the target message after any switch receives the target message to be forwarded, so as to avoid the situation that other switches are in a relatively idle state when one switch undertakes too many message forwarding tasks, avoid the waste of message forwarding resources of the switch, and improve the forwarding efficiency of the message. The above technical solution solves the problems of low message forwarding efficiency in the related technology and achieves the technical effect of improving the forwarding efficiency of the message. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0023] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0024] Figure 1 It is a hardware environment schematic diagram of a message forwarding method according to an embodiment of the present application;

[0025] Figure 2 is a flow chart of a message forwarding method according to an embodiment of the present application;

[0026] Figure 3 is a flow chart of a switch information refresh method according to an embodiment of the present application;

[0027] Figure 4 It is an architectural diagram of a message forwarding method according to an embodiment of the present application;

[0028] Figure 5 is a schematic diagram of a switch information maintenance method according to an embodiment of the present application;

[0029] Figure 6 It is a flow chart of a loopback message forwarding method under a multi-core architecture according to an embodiment of the present application;

[0030] Figure 7 It is a structural block diagram of a message forwarding device according to an embodiment of the present application. DETAILED DESCRIPTION

[0031] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0032] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0033] The method embodiments provided in the embodiments of the present application can be executed in a computer terminal, a device terminal or a similar computing device. Taking running on a computer terminal as an example, Figure 1 Schematic diagram of the hardware environment of a message forwarding method according to an embodiment of the present application. Figure 1 As shown, the computer terminal may include one or more ( Figure 1 Only one is shown in the figure) processor 102 (processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. In an exemplary embodiment, the computer terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above-mentioned computer terminal. Figure 1 More or fewer components as shown, or with Figure 1 Equivalent functions or comparisons shown Figure 1 A different configuration with more features is shown.

[0034] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for sending message push in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0035] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of a computer terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0036] In this embodiment, a message forwarding method is provided, which is applied to the above-mentioned computer terminal. The switch includes a controller and a plurality of switches. The controller is connected to each switch respectively. The switch is used to transmit message data between network devices. The method is also applied to the controller. Figure 2 1 is a flow chart of a method for forwarding a message according to an embodiment of the present application, the flow includes the following steps:

[0037] Step S202, receiving a target message and message information of the target message sent by a first switch among the multiple switches, wherein the message information is used to indicate a forwarding mode of the target message, and the target message is a message to be forwarded received by the first switch;

[0038] Step S204, selecting a second switch from the plurality of switches according to the switch information and the message information of each switch, wherein the switch information is used to indicate the current message forwarding service load of the switch;

[0039] Step S206: Control the second switch to perform a forwarding operation corresponding to the message information on the target message.

[0040] Through the above steps, the switch includes a controller and multiple switches, the controller is connected to each switch respectively, the switch is used to transmit message data between network devices, the controller receives the target message to be forwarded and the message information for indicating the forwarding mode of the target message sent by the first switch among the multiple switches, and then selects the second switch from the multiple switches according to the switch information and message information for indicating the current message forwarding service load of the switch, and controls the second switch to perform the forwarding operation corresponding to the message information on the target message, that is, the controller will select the appropriate second switch to complete the forwarding operation of the target message according to the current message forwarding service load of each switch and the forwarding mode of the target message after any switch receives the target message to be forwarded, so as to avoid the situation that other switches are in a relatively idle state when one switch undertakes too many message forwarding tasks, avoid the waste of message forwarding resources of the switch, and improve the forwarding efficiency of the message. The above technical solution solves the problems of low message forwarding efficiency in the related technology and achieves the technical effect of improving the forwarding efficiency of the message.

[0041] Optionally, in an embodiment of the present application, including but not limited to, multiple processor cores are arranged in the switch, the master core is the controller, and the multiple slave cores are multiple switches.

[0042] In the technical solution provided in the above step S202, the message information is used to indicate the forwarding method of the target message, which may include but is not limited to the length of the message and whether the message needs to be looped back.

[0043] Optionally, in this embodiment, including but not limited to receiving the target message and the message information of the target message sent by the first switch when the business of the switch is relatively busy, and not receiving the target message and the message information when the business is relatively idle. In this way, when the load pressure of a single switch is too large and other switches are idle, the controller intervenes to balance the load, and when the overall pressure is relatively low, each switch itself directly completes the task of forwarding the received message.

[0044] Optionally, in an embodiment of the present application, including but not limited to detecting switch information, when it is detected that the message forwarding service load indicated by the switch information exceeds the service load capacity of the message forwarding service that can be undertaken by a single switch, receiving the target message and message information of the target message sent by the first switch among multiple switches.

[0045] In the technical solution provided in the above step S204, the switch information is used to indicate the current message forwarding service load of the switch, which may include but is not limited to the length of the message processed by the switch or the data volume of the message.

[0046] Optionally, in this embodiment, selecting a second switch from multiple switches based on the switch information and message information of each switch includes but is not limited to selecting a switch with the smallest message forwarding service load indicated by the switch information from multiple switches as the second switch based on the switch information; or detecting whether the target message is a message that needs to be looped back based on the message information, and when it is detected that the target message is a message that needs to be looped back, selecting switches that can implement the loopback function from multiple switches to obtain a switch set, and then selecting the second switch from the switch set based on the switch information in the switch set.

[0047] In the technical solution provided in the above step S206, controlling the second switch to perform a forwarding operation corresponding to the message information on the target message includes but is not limited to sending the target message and the message information to the second switch, and the second switch is configured to process and forward the message according to the received message and the message information of the message.

[0048] In an exemplary embodiment, a second switch is selected from multiple switches based on switch information and message information of each switch, including: detecting prediction information of each switch based on message information and switch information, wherein the prediction information is used to indicate the message forwarding service load status of the switch after currently undertaking the forwarding operation task of the target message; and selecting the second switch from multiple switches based on the switch information and the prediction information.

[0049] Optionally, in the embodiment of the present application, the prediction information is used to indicate the message forwarding service load of the switch after the forwarding load of the target message is added to the current load of the switch. Based on the acquisition of the prediction information, the second switch that performs the forwarding operation is selected with the help of the prediction information, so that if there is a target message that will cause the switch to be overloaded, the forwarding task of the target message will be processed by the switch that receives the target message, thereby reducing the impact on other messages to be forwarded.

[0050] In an exemplary embodiment, a second switch is selected from a plurality of switches according to switch information and prediction information, including: extracting a switch with the smallest switch parameter from a plurality of switches according to switch parameters of each switch to obtain a reference switch, wherein the switch parameter is used to indicate the data volume of a message to be processed by the switch, and the switch information includes the switch parameter; detecting the size relationship between the switch parameter of the reference switch and the message threshold of the reference switch; in the case where it is detected that the switch parameter of the reference switch is less than or equal to the message threshold, determining the first switch as the second switch; in the case where it is detected that the switch parameter of the reference switch is greater than the message threshold, detecting the size relationship between the prediction parameter of the reference switch and the message threshold, wherein the prediction parameter is used to indicate the data volume of a message to be processed after the reference switch currently undertakes a forwarding operation task, and the prediction information includes the prediction parameter; in the case where it is detected that the prediction parameter is greater than or equal to the message threshold, determining the reference switch as the second switch; in the case where it is detected that the prediction parameter is less than the message threshold, determining the first switch as the second switch.

[0051] As an optional implementation, screening out a second switch from multiple switches based on the switch information and message information of each switch includes extracting a switch with the smallest switch parameter from multiple switches based on the switch parameters of each switch to obtain a reference switch, wherein the switch parameter is used to indicate the data volume of the message to be processed by the switch, and the switch information includes the switch parameter; detecting the size relationship between the switch parameter of the reference switch and the message threshold of the reference switch; when it is detected that the switch parameter of the reference switch is less than or equal to the message threshold, determining the first switch as the second switch; when it is detected that the switch parameter of the reference switch is greater than the message threshold, determining the reference switch as the second switch.

[0052] In an exemplary embodiment, the method also includes: detecting whether the information refresh opportunity has arrived; when it is detected that the information refresh opportunity has arrived, refreshing the switch information of each switch according to the capability information of each switch, wherein the capability information is used to indicate the status of the messages that the switch can forward and process within the time period from the time when the last refresh opportunity arrived to the time when the current refresh opportunity arrived.

[0053] Optionally, in this embodiment, it includes but is not limited to setting the next refresh opportunity to arrive at a fixed time interval after the arrival of a refresh opportunity, or setting the next refresh opportunity to arrive at any time after completing the refresh of the switch information of each switch according to actual usage requirements.

[0054] Optionally, in an embodiment of the present application, the capability information of each switch may be fixed, or may be constantly changing according to changes in the network environment, and the present application does not limit this.

[0055] In an exemplary embodiment, the switch information of each switch is refreshed according to the capability information of each switch, including: detecting the size relationship between the operating parameters and refresh parameters of each switch, wherein the operating parameters are used to indicate the data volume of the message to be processed by the switch, and the refresh parameters are used to indicate the data volume of the message that can be forwarded and processed by the switch within a time period, the capability information includes the refresh parameters, and the switch information includes the operating parameters; when it is detected that the operating parameters are greater than or equal to the refresh parameters, calculating the difference between the operating parameters and the refresh parameters to obtain a first refresh value; refreshing the switch information using the operating parameters replaced by the first refresh value; when it is detected that the operating parameters are less than the refresh parameters, determining the second refresh value to be 0; and refreshing the switch information using the operating parameters replaced by the second refresh value.

[0056] Optionally, in this embodiment, Figure 3 1 is a flow chart of a method for refreshing switch information according to an embodiment of the present application. Figure 3 As shown, a load refresh timer module can be set on the controller to be responsible for periodically refreshing the load value (i.e., operating parameter) of each of the (M+1) slave cores (i.e., slave core 0 to slave core M) by subtraction. The purpose is to make the load value truly reflect the load situation of the slave core within the cycle. If this operation is not performed, the load value will only be accumulated. When the message flow stops after a period of time on some slave cores, if this load value is not refreshed and reduced, it will cause the switch selection error. By continuously reading each slave core load register and each slave core load refresh value register to obtain the current load value of each slave core and the refresh value of each slave core to update the load value of each slave core, the correct switch selection can be ensured.

[0057] In an exemplary embodiment, a switch includes a first engine and a second engine, the first engine is connected to the second engine, and the first engine and the second engine are both connected to a controller, the first engine is used to receive a first message to be processed and parse the first message to obtain first information indicating a forwarding mode of the first message and send the first message and the first information to the controller, the second engine is used to receive a second message to be processed sent by the controller and forward the second message according to the second information of the second message indicating a forwarding mode of the second message, before the second switch is screened out from a plurality of switches according to the switch information and message information of each switch, the method also includes: receiving a first parameter sent by the first engine and a second parameter sent by the second engine, wherein the first engine is configured to send a first parameter to the controller when receiving the first message, the first parameter is used to indicate a message data volume of the first message, and the first information includes the first parameter, the second engine is configured to send a second parameter to the controller when receiving the second message, the second parameter is used to indicate a message data volume of the second message, and the second information includes the second parameter; and updating the switch information according to the first parameter and the second parameter.

[0058] Optionally, in this embodiment, Figure 4 is an architectural diagram of a message forwarding method according to an embodiment of the present application, Figure 5 is a schematic diagram of a switch information maintenance method according to an embodiment of the present application, such as Figure 4 and Figure 5 As shown, each switch (i.e., slave core) includes a first engine (i.e., IPE) and a second engine (EPE), and a loopback channel, i.e., Slice0-SliceM, is provided between the first engine and the second engine, and the second engine can forward the second message to the first engine in the same switch through the loopback channel. A master core receiving slave core load information module can also be provided in the controller (i.e., the master core), and a slave core information sending module can be provided in the first engine and the second engine of each switch, and the slave core information sending module is responsible for sending the message length information passing through the slave core to the master core in real time, and the master core receiving slave core load information module is responsible for saving the message length information sent from the slave core according to the slave core number.

[0059] In an exemplary embodiment, the second switch includes a third engine and a fourth engine, the third engine is connected to the fourth engine, and the third engine and the fourth engine are both connected to a controller; the second switch is controlled to perform a forwarding operation corresponding to the message information on the target message, including: detecting the forwarding requirement of the target message according to the message information, wherein the forwarding requirement is used to indicate whether the target message needs to be looped back; when it is detected that the forwarding requirement is used to indicate that the target message needs to be looped back, sending a first instruction to the fourth engine, wherein the first instruction is used to instruct the fourth engine to forward the received target message to the third engine, and the third engine is used to forward the target message to the controller when the target message is received; when it is detected that the forwarding requirement is used to indicate that the target message does not need to be looped back, sending a second instruction to the fourth engine, wherein the second instruction is used to instruct the fourth engine to forward the received target message to the next hop device connected to the switch.

[0060] As an optional implementation, Figure 6 FIG. 1 is a flow chart of a loopback message forwarding method in a multi-core architecture according to an embodiment of the present application. Figure 6 As shown in the figure, if the message to be forwarded is a loopback message, when the loopback message passes through the main core (i.e., the controller), the routing logic will be triggered, and the loopback channel selection module will select the loopback path based on the loopback path selection logic. Figure 6 The logic is to select the slave core (minLoadSlice) (i.e., the switch) with the minimum load (minLoad) according to the current load (curLoad) of each slave core. If the load of the selected slave core exceeds the RegLoadThrd configured by the CPU (the CPU configures the bandwidth threshold upper limit for each slave core), the slave core that receives the forwarded message is selected, otherwise the minLoadSlice is selected, and the loopback message is forwarded to the EPE of the selected slave core and then returned to the IPE of the selected slave core. For example, when the load of the selected minLoadSlice exceeds the 2T bps configured by the CPU, it is considered that it has exceeded the bandwidth capacity of the current slave core. At this time, the loopback message is still looped back from its original forwarding core. Through the above steps, the problem of packet loss caused by the loopback message on each core can be effectively balanced.

[0061] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software and a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods of each embodiment of the present application.

[0062] Figure 7 is a structural block diagram of a message forwarding device according to an embodiment of the present application; Figure 7 As shown, the switch includes a controller and a plurality of switches, the controller is connected to each switch respectively, the switch is used to transmit message data between network devices, the device is applied to the controller, and the device includes:

[0063] The first receiving module 702 is used to receive a target message and message information of the target message sent by a first switch among the multiple switches, wherein the message information is used to indicate a forwarding mode of the target message, and the target message is a message to be forwarded received by the first switch;

[0064] A screening module 704, configured to screen out a second switch from a plurality of switches according to switch information and message information of each switch, wherein the switch information is used to indicate a current message forwarding service load of the switch;

[0065] The control module 706 is used to control the second switch to perform a forwarding operation corresponding to the message information on the target message.

[0066] Through the above embodiment, the switch includes a controller and multiple switches, the controller is connected to each switch respectively, the switch is used to transmit message data between network devices, the controller receives the target message to be forwarded and the message information for indicating the forwarding mode of the target message sent by the first switch among the multiple switches, and then selects the second switch from the multiple switches according to the switch information and message information for indicating the current message forwarding service load of the switch, and controls the second switch to perform the forwarding operation corresponding to the message information on the target message, that is, the controller will select the appropriate second switch to complete the forwarding operation of the target message according to the current message forwarding service load of each switch and the forwarding mode of the target message after any switch receives the target message to be forwarded, so as to avoid the situation that other switches are in a relatively idle state when one switch undertakes too many message forwarding tasks, avoid the waste of message forwarding resources of the switch, and improve the forwarding efficiency of the message. The above technical solution solves the problems of low message forwarding efficiency in the related technology and achieves the technical effect of improving the forwarding efficiency of the message.

[0067] In an exemplary embodiment, the screening module includes: a first detection unit, used to detect the prediction information of each switch based on the message information and the switch information, wherein the prediction information is used to indicate the message forwarding business load status after the switch currently undertakes the forwarding operation task of the target message; a screening unit, used to screen out the second switch from multiple switches based on the switch information and the prediction information.

[0068] In an exemplary embodiment, the screening unit is further used to: extract a switch with the smallest switch parameter from multiple switches according to the switch parameter of each switch to obtain a reference switch, wherein the switch parameter is used to indicate the data volume of the message to be processed by the switch, and the switch information includes the switch parameter; detect the size relationship between the switch parameter of the reference switch and the message threshold of the reference switch; when it is detected that the switch parameter of the reference switch is less than or equal to the message threshold, determine the first switch as the second switch; when it is detected that the switch parameter of the reference switch is greater than the message threshold, detect the size relationship between the prediction parameter of the reference switch and the message threshold, wherein the prediction parameter is used to indicate the data volume of the message to be processed after the reference switch currently undertakes the forwarding operation task, and the prediction information includes the prediction parameter; when it is detected that the prediction parameter is greater than or equal to the message threshold, determine the reference switch as the second switch; when it is detected that the prediction parameter is less than the message threshold, determine the first switch as the second switch.

[0069] In an exemplary embodiment, the device also includes: a detection module, which is used to detect whether the information refresh opportunity has arrived; a refresh module, which is used to refresh the switch information of each switch according to the capability information of each switch when the information refresh opportunity is detected to have arrived, wherein the capability information is used to indicate the status of the messages that the switch can forward and process within the time period from the time when the last refresh opportunity arrives to the time when the current refresh opportunity arrives.

[0070] In an exemplary embodiment, a refresh module includes: a second detection unit, which is used to detect the size relationship between the operating parameters and refresh parameters of each switch, wherein the operating parameters are used to indicate the data volume of the message to be processed by the switch, and the refresh parameters are used to indicate the data volume of the message that can be forwarded and processed by the switch within a time period, the capability information includes the refresh parameters, and the switch information includes the operating parameters; a calculation unit, which is used to calculate the difference between the operating parameters and the refresh parameters to obtain a first refresh value when it is detected that the operating parameters are greater than or equal to the refresh parameters; a first refresh unit, which is used to refresh the switch information using the operating parameters replaced by the first refresh value; a determination unit, which is used to determine that the second refresh value is 0 when it is detected that the operating parameters are less than the refresh parameters; and a second refresh unit, which is used to refresh the switch information using the operating parameters replaced by the second refresh value.

[0071] In an exemplary embodiment, a switch includes a first engine and a second engine, the first engine is connected to the second engine, and the first engine and the second engine are both connected to a controller, the first engine is used to receive a first message to be processed and parse the first message to obtain first information indicating a forwarding method of the first message and send the first message and the first information to the controller, the second engine is used to receive a second message to be processed sent by the controller and forward the second message according to the second information of the second message indicating a forwarding method of the second message, and the device also includes: a second receiving module, used to receive a first parameter sent by the first engine and a second parameter sent by the second engine, wherein the first engine is configured to send a first parameter to the controller when receiving the first message, the first parameter is used to indicate a message data volume of the first message, and the first information includes the first parameter, the second engine is configured to send a second parameter to the controller when receiving the second message, the second parameter is used to indicate a message data volume of the second message, and the second information includes the second parameter; an updating module, used to update the switch information according to the first parameter and the second parameter.

[0072] In an exemplary embodiment, the second switch includes a third engine and a fourth engine, the third engine is connected to the fourth engine, and the third engine and the fourth engine are both connected to a controller, and the control module includes: a third detection unit, used to detect the forwarding requirement of the target message according to the message information, wherein the forwarding requirement is used to indicate whether the target message needs to be looped back; a first sending unit, used to send a first instruction to the fourth engine when it is detected that the forwarding requirement is used to indicate that the target message needs to be looped back, wherein the first instruction is used to instruct the fourth engine to forward the received target message to the third engine, and the third engine is used to forward the target message to the controller when it receives the target message; a second sending unit, used to send a second instruction to the fourth engine when it is detected that the forwarding requirement is used to indicate that the target message does not need to be looped back, wherein the second instruction is used to instruct the fourth engine to forward the received target message to the next hop device connected to the switch.

[0073] An embodiment of the present application further provides a storage medium, which includes a stored program, wherein when the program is run, any of the above-mentioned message forwarding methods is executed.

[0074] Optionally, in this embodiment, the storage medium may be configured to store program codes for executing the following steps:

[0075] S1, receiving a target message and message information of the target message sent by a first switch among multiple switches, wherein the message information is used to indicate a forwarding mode of the target message, and the target message is a message to be forwarded received by the first switch;

[0076] S2, selecting a second switch from the plurality of switches according to the switch information and the message information of each switch, wherein the switch information is used to indicate the current message forwarding service load of the switch;

[0077] S3, controlling the second switch to perform a forwarding operation corresponding to the message information on the target message.

[0078] An embodiment of the present application further provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above-mentioned message forwarding method embodiments.

[0079] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0080] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0081] S1, receiving a target message and message information of the target message sent by a first switch among multiple switches, wherein the message information is used to indicate a forwarding mode of the target message, and the target message is a message to be forwarded received by the first switch;

[0082] S2, selecting a second switch from the plurality of switches according to the switch information and the message information of each switch, wherein the switch information is used to indicate the current message forwarding service load of the switch;

[0083] S3, controlling the second switch to perform a forwarding operation corresponding to the message information on the target message.

[0084] Optionally, in this embodiment, the above-mentioned storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store program codes.

[0085] Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation modes, and this embodiment will not be described in detail here.

[0086] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order from that herein, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present application is not limited to any specific combination of hardware and software.

[0087] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A message forwarding method, characterized in that: The switch includes a controller and a plurality of switches, wherein the controller is connected to each of the switches respectively, and the switches are used to transmit message data between network devices. The method is applied to the controller, and the method includes: receiving a target message and message information of the target message sent by a first switch among the plurality of switches, wherein the message information is used to indicate a forwarding mode of the target message, and the target message is a message to be forwarded received by the first switch; Filtering out a second switch from the plurality of switches according to the switch information and the message information of each switch, wherein the switch information is used to indicate the current message forwarding service load of the switch; The second switch is controlled to perform a forwarding operation corresponding to the message information on the target message.

2. The method according to claim 1, characterized in that The step of selecting a second switch from the plurality of switches according to the switch information and the message information of each switch includes: Detecting prediction information of each of the switches according to the message information and the switch information, wherein the prediction information is used to indicate the message forwarding service load of the switch after the switch currently undertakes the forwarding operation task of the target message; The second switch is selected from the plurality of switches according to the switch information and the prediction information.

3. The method according to claim 2, characterized in that The step of selecting the second switch from the plurality of switches according to the switch information and the prediction information includes: Extracting a switch with the smallest switch parameter from the plurality of switches according to a switch parameter of each switch to obtain a reference switch, wherein the switch parameter is used to indicate a data volume of a message to be processed by the switch, and the switch information includes the switch parameter; Detecting a magnitude relationship between the switch parameter of the reference switch and a message threshold of the reference switch; In a case where it is detected that the switch parameter of the reference switch is less than or equal to the message threshold, determining the first switch as the second switch; In the case where it is detected that the switch parameter of the reference switch is greater than the message threshold, detecting a size relationship between a prediction parameter of the reference switch and the message threshold, wherein the prediction parameter is used to indicate a data volume of messages to be processed after the reference switch currently undertakes the forwarding operation task, and the prediction information includes the prediction parameter; In the case where it is detected that the prediction parameter is greater than or equal to the message threshold, determining the reference switch as the second switch; When it is detected that the prediction parameter is less than the message threshold, the first switch is determined as the second switch.

4. The method according to claim 1, characterized in that: The method further comprises: Check whether the information refresh timing has arrived; When it is detected that the information refresh opportunity has arrived, the switch information of each switch is refreshed according to the capability information of each switch, wherein the capability information is used to indicate the messages that the switch can forward and process within the time period from the time when the last refresh opportunity arrives to the time when the current refresh opportunity arrives.

5. The method according to claim 4, characterized in that The step of refreshing the switch information of each of the switches according to the capability information of each of the switches comprises: Detecting the size relationship between the operating parameters and refresh parameters of each of the switches, wherein the operating parameters are used to indicate the data volume of the message to be processed by the switch, and the refresh parameters are used to indicate the data volume of the message that can be forwarded and processed by the switch within the time period, the capability information includes the refresh parameters, and the switch information includes the operating parameters; When it is detected that the operating parameter is greater than or equal to the refresh parameter, calculating the difference between the operating parameter and the refresh parameter to obtain a first refresh value; and refreshing the switch information using the operating parameter replaced by the first refresh value; In the case where it is detected that the operating parameter is less than the refresh parameter, determining the second refresh value to be 0; The switch information is updated using the operating parameter replaced by the second updated value.

6. The method according to claim 1, characterized in that The switch includes a first engine and a second engine, the first engine is connected to the second engine, the first engine and the second engine are both connected to the controller, the first engine is used to receive a first message to be processed and parse the first message to obtain first information indicating a forwarding method of the first message and send the first message and the first information to the controller, the second engine is used to receive a second message to be processed sent by the controller and forward the second message according to the second information of the second message indicating a forwarding method of the second message, Before selecting the second switch from the plurality of switches according to the switch information and the message information of each switch, the method further includes: receiving a first parameter sent by the first engine and a second parameter sent by the second engine, wherein the first engine is configured to send the first parameter to the controller when receiving the first message, the first parameter is used to indicate the message data volume of the first message, and the first information includes the first parameter; the second engine is configured to send the second parameter to the controller when receiving the second message, the second parameter is used to indicate the message data volume of the second message, and the second information includes the second parameter; The switch information is updated according to the first parameter and the second parameter.

7. The method according to claim 1, characterized in that The second exchanger includes a third engine and a fourth engine, the third engine is connected to the fourth engine, and the third engine and the fourth engine are both connected to the controller; The controlling the second switch to perform a forwarding operation corresponding to the message information on the target message includes: Detecting a forwarding requirement of the target message according to the message information, wherein the forwarding requirement is used to indicate whether the target message needs to be looped back; When it is detected that the forwarding requirement is used to indicate that the target message needs to be looped back, a first instruction is sent to the fourth engine, wherein the first instruction is used to instruct the fourth engine to forward the received target message to the third engine, and the third engine is used to forward the target message to the controller when the target message is received; When it is detected that the forwarding requirement is used to indicate that the target message does not need a loopback, a second instruction is sent to the fourth engine, wherein the second instruction is used to instruct the fourth engine to forward the received target message to a next-hop device connected to the switch.

8. A message forwarding device, characterized in that: The switch includes a controller and a plurality of switches, wherein the controller is connected to each of the switches respectively, and the switches are used to transmit message data between network devices. The device is applied to the controller, and the device includes: A first receiving module, used for receiving a target message and message information of the target message sent by a first switch among the plurality of switches, wherein the message information is used for indicating a forwarding mode of the target message, and the target message is a message to be forwarded received by the first switch; A screening module, used for screening out a second switch from the plurality of switches according to the switch information and the message information of each switch, wherein the switch information is used for indicating the current message forwarding service load of the switch; The control module is used to control the second switch to perform a forwarding operation corresponding to the message information on the target message.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method according to any one of claims 1 to 7 when executed.

10. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.