Switch control method and apparatus, non-volatile readable storage medium, and electronic device

By obtaining the number of PFC pause frames recorded by the PFC counter in the switch and sending control instructions to the target switch, it solves the problem that switches without PFC counters cannot detect PFC storms, achieves timely detection and mitigation of PFC storms, and ensures The stability of the switch transmission link.

WO2024183390A1PCT designated stage expired Publication Date: 2024-09-12INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/138959
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-03-03
Filing Date
2023-12-14
Publication Date
2024-09-12

AI Technical Summary

Technical Problem

Switches without PFC counters cannot detect and mitigate PFC storms, resulting in increased packet queue congestion.

Method used

By obtaining the number of PFC pause frames recorded by the PFC counter in the reference switch, and sending control instructions to the target switch when the preset conditions are met, instructing the packets to be discarded or retained, PFC storm detection and mitigation can be achieved for switches without PFC counters deployed.

Benefits of technology

Effectively solves the problem of packet queue congestion in PFC storms on switches without PFC counters deployed, ensuring the stability of the switch transmission link.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023138959_12092024_PF_FP_ABST
    Figure CN2023138959_12092024_PF_FP_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a switch control method and apparatus, a non-volatile readable storage medium, and an electronic device. The switch control method comprises: acquiring a first transmission quantity corresponding to a target packet queue and recorded in a priority-based flow control (PFC) counter in a reference switch; and when the first transmission quantity meets a preset first control condition, transmitting a first control instruction to a target switch, wherein the first control instruction is used for instructing to perform a discard operation on a packet in the target packet queue. By means of the embodiments of the present application, the problem that a switch on which no PFC counter is deployed cannot detect a PFC storm is solved, so that when a PFC storm occurs, the switch on which no PFC counter is deployed can detect the PFC storm in a timely manner.
Need to check novelty before this filing date? Find Prior Art

Description

Switch control method and device, non-volatile readable storage medium and electronic device

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on March 3, 2023, with application number 202310199163.6, entitled “Control method and device, storage medium and electronic device for a switch”, the entire contents of which are incorporated herein by reference. Technical Field

[0003] Embodiments of the present application relate to the field of switches, and in particular, to a switch control method and device, a non-volatile readable storage medium, and an electronic device. Background Art

[0004] During packet transmission, a switch often needs to periodically read the PFC counter to detect whether a PFC storm has occurred. If a PFC storm is detected, the switch can initiate a PFC pause. However, not all switch chips have PFC counters. For example, some chips may not have a PFC counter for cost reasons. Alternatively, some switches may have PFC counters but the counters may be damaged, rendering them inoperable. Consequently, switches without PFC functionality cannot detect and mitigate PFC storms on every port.

[0005] In the related art, in the event of a PFC storm, a switch that is not equipped with a PFC counter cannot detect the PFC storm, and no effective solution has been proposed yet.

[0006] Summary of the Invention

[0007] Embodiments of the present application provide a switch control method and device, a non-volatile readable storage medium, and an electronic device to at least solve the problem in the related art that switches that are not equipped with a PFC counter cannot detect PFC storms.

[0008] According to one embodiment of the present application, a switch control method is provided, comprising: obtaining a first send quantity corresponding to a target packet queue, recorded in a priority-based flow control (PFC) counter in a reference switch, wherein the first send quantity is the number of PFC pause frames corresponding to the target packet queue sent by the reference switch to a target switch, the target packet queue being a packet queue on the target switch; and sending a first control instruction to the target switch if the first send quantity satisfies a preset first control condition, wherein the first control instruction is used to instruct the target switch to discard packets in the target packet queue.

[0009] In an exemplary embodiment, before sending the first control instruction to the target switch, the method further includes: determining that the first transmission quantity satisfies the first control condition when the first transmission quantity is greater than or equal to a preset first quantity threshold; or determining that the first transmission quantity satisfies the first control condition when, based on the first transmission quantity, the number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch within a first preset time period is greater than or equal to a preset second quantity threshold.

[0010] In an exemplary embodiment, the method further includes: obtaining a last sent number, wherein the last sent number is a cumulative number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch at a first moment, and the first sent number is a cumulative number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch at a second moment, the first moment being earlier than the second moment, and a duration between the first moment and the second moment being a first preset duration; and determining a difference between the first sent number and the last sent number as the number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch within the first preset duration.

[0011] In an exemplary embodiment, sending a first control instruction to a target switch includes: sending the first control instruction to a second transmission module in the target switch via a first transmission module in a reference switch, wherein the first transmission module and the second transmission module are connected to a second port on the target switch via a first port on the reference switch, the target packet queue is a packet queue on the second port on the target switch, and the first control instruction includes a queue number of the target packet queue and a first operation identifier, wherein the first operation identifier is used to perform a discard operation on the packet.

[0012] In an exemplary embodiment, sending a first control instruction to a second transmission module in a target switch through a first transmission module in a reference switch includes: sending the first control instruction to the second LLDP module in the target switch through a target transmission link through a first link layer discovery protocol LLDP module in the reference switch, wherein the first control instruction is a message encapsulated in an LLDP transmission format, and the target transmission link is a transmission link between a first port and a second port.

[0013] In an exemplary embodiment, sending the first control instruction to the target switch includes: sending the first control instruction to the fourth transmission module in the target switch via the network controller through the third transmission module in the reference switch, wherein the first control instruction includes the IP address of the reference switch, the IP address of the target switch, a first port number of a first port on the reference switch, a second port number of a second port on the target switch, a queue number of a target packet queue, and a first operation identifier, wherein the first operation identifier is used to perform a discard operation on the packet.

[0014] In an exemplary embodiment, after sending the first control instruction to the target switch, the method includes: obtaining a second send quantity corresponding to the target packet queue and recorded in a PFC counter in the reference switch; and sending a second control instruction to the target switch if the second send quantity satisfies a preset second control condition, wherein the second control instruction is used to instruct to perform a retain operation on packets in the target packet queue.

[0015] In an exemplary embodiment, before sending the second control instruction to the target switch, the method further includes: determining that the second transmission quantity satisfies the second control condition when the second transmission quantity is less than a preset third quantity threshold; or determining that the second transmission quantity satisfies the second control condition when it is determined based on the second transmission quantity that the number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch within a second preset time period is less than a preset fourth quantity threshold.

[0016] In an exemplary embodiment, sending the second control instruction to the target switch includes: sending the second control instruction to the second transmission module in the target switch via a first transmission module in a reference switch, wherein the first transmission module and the second transmission module are connected to a second port on the target switch via a first port on the reference switch, the target packet queue is a packet queue on the second port on the target switch, and the second control instruction includes a queue number of the target packet queue and a second operation identifier, wherein the second operation identifier is used to perform a retain operation on the packet.

[0017] In an exemplary embodiment, sending the second control instruction to the target switch includes: sending the second control instruction to the second LLDP module in the target switch via the target transmission link through the first LLDP module in the reference switch, wherein the second control instruction is a message encapsulated in the LLDP transmission format, and the target transmission link is a transmission link between the first port and the second port.

[0018] In an exemplary embodiment, sending the second control instruction to the target switch includes: sending the second control instruction to the fourth transmission module in the target switch via the network controller through the third transmission module in the reference switch, wherein the second control instruction includes the IP address of the reference switch, the IP address of the target switch, a first port number of a first port on the reference switch, a second port number of a second port on the target switch, a queue number of a target message queue, and a second operation identifier, wherein the second operation identifier is used to perform a retain operation on the message.

[0019] In an exemplary embodiment, after sending a second control instruction to a target switch, the method further includes: obtaining a queue number and a second operation identifier of a target packet queue from the second control instruction, wherein the second control instruction is a control instruction received on a second port; and performing a retain operation on packets in a target packet queue on the second port of the target switch, wherein the target packet queue is a packet queue identified by the queue number, and the retain operation is an operation indicated by the second operation identifier.

[0020] In an exemplary embodiment, performing a retain operation on a message in a target message queue on a second port on a target switch includes: deleting an ACL rule generated by an access control list (ACL) control module, wherein the ACL rule is used to instruct to perform a discard operation on the message in the target message queue.

[0021] In an exemplary embodiment, after sending the second control instruction to the target switch, the method further includes: obtaining a second port number, a queue number of the target message queue, and a second operation identifier from the second control instruction; and performing a retain operation on messages in the target message queue on a second port of the target switch, wherein the second port is a port identified by the second port number, the target message queue is a message queue identified by the queue number, and the retain operation is an operation indicated by the second operation identifier.

[0022] According to another embodiment of the present application, a switch control method is provided, comprising: obtaining a first control instruction sent by a reference switch, wherein the first control instruction is used to instruct to perform a discard operation on messages in a target message queue, the first control instruction being a control instruction sent from the reference switch to the target switch when a first transmission quantity satisfies a preset first control condition, the target message queue being a message queue on the target switch, the first transmission quantity being recorded in a priority-based flow control (PFC) counter in the reference switch, and the first transmission quantity being the number of PFC pause frames corresponding to the target message queue sent by the reference switch to the target switch; and performing a discard operation on the messages in the target message queue on the target switch in response to the first control instruction.

[0023] In an exemplary embodiment, obtaining a first control instruction sent by a reference switch includes: obtaining a first control instruction sent by a first port on the reference switch to a second port on a target switch, wherein the first control instruction includes a queue number and a first operation identifier of a target packet queue, the first operation identifier being used to perform a discard operation on packets, and the target packet queue is a packet queue on the second port on the target switch; performing a discard operation on packets in a target packet queue on the target switch includes: obtaining the queue number and the first operation identifier of the target packet queue from the first control instruction; and performing a discard operation on packets in the target packet queue on the second port on the target switch, wherein the target packet queue is a packet queue identified by the queue number, and the discard operation is the operation indicated by the first operation identifier.

[0024] In an exemplary embodiment, performing a discard operation on a message in a target message queue on a target switch includes: generating an access control list (ACL) rule by an ACL control module in the target switch, wherein the ACL rule is used to instruct to perform a discard operation on the message in the target message queue; and performing the discard operation on the message in the target message queue according to the ACL rule.

[0025] In an exemplary embodiment, obtaining a first control instruction sent by a reference switch includes: obtaining the first control instruction sent by a third transmission module in the reference switch to a fourth transmission module in a target switch via a network controller, wherein the first control instruction includes an IP address of the reference switch, an IP address of the target switch, a first port number of a first port on the reference switch, a second port number of a second port on the target switch, a queue number of a target packet queue, and a first operation identifier, wherein the first operation identifier is used to perform a discard operation on a packet, and the target packet queue is a packet queue on a second port on the target switch; performing a discard operation on a packet in a target packet queue on the target switch includes: obtaining the second port number, the queue number of the target packet queue, and the first operation identifier from the first control instruction; performing a discard operation on a packet in the target packet queue on the second port of the target switch, wherein the second port is a port identified by the second port number, the target packet queue is a packet queue identified by the queue number, and the discard operation is the operation indicated by the first operation identifier.

[0026] In an exemplary embodiment, performing a discard operation on a message in a target message queue on a second port on a target switch includes: generating an access control list (ACL) rule by an ACL control module in the target switch, wherein the ACL rule is used to instruct to perform a discard operation on the message in the target message queue on the second port; and performing the discard operation on the message in the target message queue on the second port according to the ACL rule.

[0027] According to another embodiment of the present application, a control device for a switch is provided, comprising: a first obtaining module, configured to obtain a first sending quantity corresponding to a target packet queue, recorded in a priority-based flow control (PFC) counter in a reference switch, wherein the first sending quantity is the number of PFC pause frames corresponding to the target packet queue sent by the reference switch to a target switch, and the target packet queue is a packet queue on the target switch; and a first sending module, configured to send a first control instruction to the target switch if the first sending quantity satisfies a preset first control condition, wherein the first control instruction is used to instruct the target switch to perform a discard operation on packets in the target packet queue.

[0028] According to another embodiment of the present application, a control device for a switch is provided, comprising: a sixth acquisition module configured to acquire a first control instruction sent by a reference switch, wherein the first control instruction is used to instruct to perform a discard operation on packets in a target packet queue, the first control instruction being a control instruction sent from the reference switch to the target switch when a first transmission quantity satisfies a preset first control condition, the target packet queue being a packet queue on the target switch, the first transmission quantity being recorded in a priority-based flow control (PFC) counter of the reference switch, and the first transmission quantity being the number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch; and a third execution module configured to, in response to the first control instruction, perform a discard operation on the packets in the target packet queue on the target switch.

[0029] According to another embodiment of the present application, a non-volatile readable storage medium is provided, in which a computer program is stored. The computer program is configured to execute the steps of any of the above method embodiments when running.

[0030] According to another embodiment of the present application, an electronic device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0031] According to an embodiment of the present application, when a target switch sends packets to a reference switch, a PFC counter on the reference switch records the number of PFC pause frames sent by the reference switch to the target packet queue of the target switch. If the number of PFC pause frames meets a control condition, it can indicate that a PFC storm has occurred in the target packet queue of the target switch. In this case, a control instruction is sent to a switch that does not have a PFC counter function, so that the switch that does not have a PFC counter function can promptly discard packets in the congested packet queue, thereby avoiding exacerbating congestion in the packet queue of the target switch that has experienced a PFC storm. Therefore, the problem of switches that do not have a PFC counter being unable to detect PFC storms can be solved, and the switch that does not have a PFC counter can promptly detect PFC storms when a PFC storm occurs. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] FIG1 is a hardware structure block diagram of a mobile terminal for a switch control method according to an embodiment of the present application;

[0033] FIG2 is a schematic diagram of an application scenario of a switch control method according to an embodiment of the present application;

[0034] FIG3 is a schematic diagram of sending and receiving a pause frame according to an embodiment of the present application;

[0035] FIG4 is a schematic diagram of a method for controlling a switch according to an embodiment of the present application;

[0036] FIG5 is a flowchart of a method for controlling a switch according to an embodiment of the present application;

[0037] 6 is a schematic diagram of determining the number of PFC pause frames corresponding to a target packet queue sent by a reference switch to a target switch within a first preset time period according to an embodiment of the present application;

[0038] FIG7 is a schematic diagram of a first control instruction according to an embodiment of the present application;

[0039] FIG8 is a second flowchart of a method for controlling a switch according to an embodiment of the present application;

[0040] FIG9 is a schematic diagram of a first embodiment of a method for discarding a message in a target message queue according to an embodiment of the present application;

[0041] FIG10 is a second schematic diagram of performing a discard operation on a message in a target message queue according to an embodiment of the present application;

[0042] FIG11 is a structural block diagram 1 of a control device for a switch according to an embodiment of the present application;

[0043] FIG12 is a second structural block diagram of the control device of the switch according to an embodiment of the present application. DETAILED DESCRIPTION

[0044] The embodiments of the present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0045] It should be noted that the terms "first", "second", etc. in the description and claims of the embodiments of this application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence.

[0046] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking the operation on a mobile terminal as an example, FIG1 is a hardware structure block diagram of a mobile terminal of a switch control method according to an embodiment of the present application. As shown in FIG1 , the mobile terminal may include one or more (only one is shown in FIG1 ) processors 102 (the 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 configured to store data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 configured to have a communication function. It will be understood by those skilled in the art that the structure shown in FIG1 is merely illustrative and does not limit the structure of the mobile terminal. For example, the mobile terminal may also include more or fewer components than those shown in FIG1 , or have a configuration different from that shown in FIG1 .

[0047] The memory 104 is configured to store computer programs, such as software programs and modules of application software, such as the computer program corresponding to the switch control method in the embodiments of the present application. The processor 102 executes the computer programs stored in the memory 104 to execute various functional applications and data processing, thereby implementing the above-mentioned methods. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some embodiments, the memory 104 includes memory remotely located relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0048] The transmission device 106 is configured to receive or transmit data via a network. Examples of such networks may include wireless networks provided by the mobile terminal's communications provider. In one embodiment, the transmission device 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission device 106 may be a radio frequency (RF) module configured to communicate with the Internet wirelessly.

[0049] Figure 2 is a schematic diagram of an application scenario of a switch control method according to an embodiment of the present application. As shown in Figure 2, a data center generally uses a three-layer architecture of Core / Spine / Leaf. The Leaf switch (i.e., the target switch) uses a lower-order chip and does not have a PFC counter. The switch in the Spine layer (i.e., the reference switch) has a PFC (Priority flow control) counter, which can observe the number of PFC pause frames sent by the Spine layer switch to the Leaf switch.

[0050] FIG3 is a schematic diagram of sending and receiving a pause frame according to an embodiment of the present application. As shown in FIG3 , the number of PFC pause frames sent by the Spine layer switch A that supports the PFC counter to the Leaf switch B is the same as the number of PFC pause frames received by the Leaf switch B. The number of PFC pause frames sent by the Spine layer switch A that supports the PFC counter to the Leaf switch C is the same as the number of PFC pause frames received by the Leaf switch C. For example, the Spine layer switch A that supports the PFC counter sends 100 PFC pause frames to the Leaf switch B, and the Leaf switch B receives 100 PFC pause frames.

[0051] As shown in conjunction with Figures 2 and 3 , through embodiments of the present application, the number of pause frames sent from switch A to switch B, as recorded by the PFC counter in switch A, can be used to determine whether a PFC storm has occurred in switch B. In other words, the PFCWD (Priority Flow Control Watchdog) behavior of switch B can be controlled by switch A. The number of pause frames sent from switch A to switch C, as recorded by the PFC counter in switch A, can be used to determine whether a PFC storm has occurred in switch C. In other words, the PFCWD behavior of switch C can be controlled by switch A.

[0052] FIG4 is a schematic diagram of a switch control method according to an embodiment of the present application. As shown in FIG4 , a first transmission quantity corresponding to a target packet queue and recorded in a priority-based flow control (PFC) counter 202-1 in a reference switch 202 is obtained; if the first transmission quantity satisfies a preset first control condition, a first control instruction is sent to a target switch 204, causing the target switch 202 to discard packets in the target packet queue. In this way, a switch that does not have a PFC counter function (i.e., the target switch 202) can also have the PFCWD function without upgrading the hardware of the switch that does not have the PFC counter function.

[0053] In this embodiment, a method for controlling a switch running on the mobile terminal is provided. FIG5 is a flowchart of the method for controlling a switch according to an embodiment of the present application. As shown in FIG5 , the flowchart includes the following steps:

[0054] Step S502: Obtain a first transmission quantity corresponding to a target packet queue and recorded in a priority-based flow control (PFC) counter of a reference switch, wherein the first transmission quantity is the number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch, where the target packet queue is a packet queue on the target switch.

[0055] Step S504: Obtain a first transmission quantity corresponding to the target packet queue and recorded in a priority-based flow control (PFC) counter in the reference switch, where the first transmission quantity is the number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch, where the target packet queue is a packet queue on the target switch.

[0056] Through the above steps, when the target switch sends packets to the reference switch, the PFC counter in the reference switch records the number of PFC pause frames sent by the reference switch to the target packet queue of the target switch. If the number of PFC pause frames meets the control condition, it can be indicated that a PFC storm has occurred in the target packet queue on the target switch. In this case, a control instruction is sent to the switch that does not have the PFC counter function, so that the switch that does not have the PFC counter function can promptly discard packets in the congested packet queue, thereby avoiding exacerbating the congestion of the packet queue on the target switch that has experienced a PFC storm. Therefore, the problem of switches that do not have the PFC counter being unable to detect PFC storms can be solved, and the effect of switches that do not have the PFC counter being able to promptly detect PFC storms when a PFC storm occurs can be achieved.

[0057] The execution subject of the above steps may be a terminal, etc., but is not limited thereto.

[0058] The execution order of step S502 and step S504 can be interchanged, that is, step S504 can be executed first, and then step S502.

[0059] In the technical solution provided in step S502 above, a priority-based flow control (PFC) counter is deployed in the reference switch. The target switch may, but is not limited to, not deploy a PFC counter, or the PFC counter in the target switch may fail and be unusable, making it impossible for the target switch to detect whether a PFC storm has occurred in itself.

[0060] Optionally, in this embodiment, the target switch includes multiple packet queues, and each of the multiple packet queues may have, but is not limited to, a corresponding PFC counter in the reference switch.

[0061] Optionally, in this embodiment, the target switch may, but is not limited to, send packets to the reference switch. When the queue buffer space in the reference switch is insufficient, a pause frame with PFC information is generated. The reference switch sends the PFC pause frame to the target switch. Upon receiving the PFC pause frame, the target switch pauses sending packets in the target packet queue to the reference switch.

[0062] In the technical solution provided in step S304 above, if the first sent number meets the preset first control condition, it can be indicated that a PFC storm has occurred in the target packet queue on the target switch. In this case, since the target switch is not deployed with a PFC counter, it is necessary to send a first control instruction to the target switch by the reference switch. The target switch promptly discards the packets in the target packet queue where the PFC storm has occurred, thereby avoiding a breakdown of the entire link.

[0063] Optionally, in this embodiment, if the target switch continuously receives PFC pause frames within a time period of 400ms (which may be but is not limited to 300ms or 200ms, etc., and is not limited in this application, and is usually not less than 100ms), it may indicate that a PFC storm has occurred.

[0064] In an exemplary embodiment, determining whether the first sending quantity satisfies the first control condition may include, but is not limited to, one of the following situations:

[0065] In scenario 1, when the first sending quantity is greater than or equal to a preset first quantity threshold, it is determined that the first sending quantity meets the first control condition.

[0066] Optionally, in this embodiment, it is possible but not limited to the case where the first sending quantity reaches an absolute value, for example, when the first sending quantity reaches 200, 300 or 600, etc., to determine that the first sending quantity meets the first control condition.

[0067] In scenario 2, when it is determined based on the first sending quantity that the number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch within the first preset time period is greater than or equal to a preset second number threshold, it is determined that the first sending quantity meets the first control condition.

[0068] Optionally, in this embodiment, if the number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch within the first preset time period is greater than or equal to a preset second number threshold, it is determined that the first sent number meets the first control condition. For example, if the number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch within 400 ms is greater than or equal to 400, it is determined that the first sent number meets the first control condition.

[0069] In an exemplary embodiment, the number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch within the first preset duration can be determined, but is not limited to, by: obtaining a last sent number, where the last sent number is the cumulative number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch at a first moment, and the first sent number is the cumulative number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch at a second moment, the first moment being earlier than the second moment, and the duration between the first moment and the second moment being the first preset duration; and determining the difference between the first sent number and the last sent number as the number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch within the first preset duration.

[0070] Optionally, in this embodiment, the number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch within the first preset time period can be determined, but is not limited to, based on the number of PFC pause frames sent by the reference switch to multiple queues in multiple ports of the target switch, as recorded in a PFC counter in the reference switch.

[0071] FIG6 is a schematic diagram of determining the number of PFC pause frames corresponding to a target packet queue sent by a reference switch to a target switch within a first preset duration according to an embodiment of the present application. As shown in FIG6 , the target switch 204 may include, but is not limited to, port P1 and port P2. Port P1 includes queue 1 and queue 2, and port P1 includes queue 3 and queue 4.

[0072] The PFC counter 202-1 in the reference switch 202 records the cumulative number A of PFC pause frames for queue 1 in port P1 and the cumulative number C of PFC pause frames for queue 2 in port P1 sent by the reference switch 202 to the target switch 204 at time t1, and the cumulative number B of PFC pause frames for queue 1 in port P1 and the cumulative number D of PFC pause frames for queue 2 in port P1 sent by the reference switch 202 to the target switch 204 at time t2.

[0073] The PFC counter 202-1 in the reference switch 202 records the cumulative number E of PFC pause frames for queue 3 on port P2 and the cumulative number G of PFC pause frames for queue 4 on port P2 sent by the reference switch 202 to the target switch 204 at time t1, and the cumulative number F of PFC pause frames for queue 3 on port P2 and the cumulative number H of PFC pause frames for queue 4 on port P1 sent by the reference switch 202 to the target switch 204 at time t2.

[0074] The duration between time t1 and time t2 is a first preset duration. For queue 1 (i.e., the target packet queue), the difference between the cumulative number A of PFC pause frames (i.e., the first sent number) at time t1 (i.e., the first time) and the cumulative number B of PFC pause frames (i.e., the last sent number) at time t2 (i.e., the second time) is determined as the number of PFC pause frames corresponding to queue 1 sent by the reference switch 202 to the target switch 204 during the duration between time t1 and time t2.

[0075] It should be noted that the PFC counter 202-1 of the reference switch 202 may, but is not limited to, not store the number of PFC pause frames sent by the reference switch 202 to the target switch 204 at each moment, but rather stores the number of PFC pause frames sent by the reference switch 202 to the target switch 204 at the current moment and the moment before the current moment.

[0076] In an exemplary embodiment, the first control instruction may be sent to the target switch in the following manner, but is not limited to: sending the first control instruction to the second transmission module in the target switch via a first transmission module in a reference switch, wherein the first transmission module and the second transmission module are connected to a second port on the target switch via a first port on the reference switch, the target packet queue is a packet queue on the second port on the target switch, and the first control instruction includes a queue number of the target packet queue and a first operation identifier, where the first operation identifier is used to perform a discard operation on the packet.

[0077] Optionally, in this embodiment, when the first transmission module of the reference switch and the second transmission module of the target switch are connected to the second port of the target switch through the first port on the reference switch, it can be indicated that the reference switch and the target switch are directly connected. In this case, the queue number of the target packet queue on which the discard operation is to be performed on the target switch can be sent through the first transmission module.

[0078] In an exemplary embodiment, the first control instruction may be sent to the target switch in the following manner, but is not limited to: the first control instruction is sent to the second LLDP module in the target switch via the target transmission link by a first link layer discovery protocol LLDP module in the reference switch, wherein the first control instruction is a message encapsulated in the LLDP transmission format, and the target transmission link is the transmission link between the first port and the second port.

[0079] Optionally, in this embodiment, the first control instruction may be, but is not limited to, a message encapsulated in the transmission format of LLDP (Link Layer Discovery Protocol). LLDP is a link layer protocol that organizes the information of the local device into TLVs (Type / Length / Value) and encapsulates them in LLDPDUs (Link Layer Discovery Protocol Data Units) and sends them to directly connected neighbors (i.e., switches). It also saves the LLDPDUs received from the neighbors in the form of a standard MIB (Management Information Base). Through LLDP, a device can save and manage its own information and that of its directly connected neighboring devices for the network management system to query and determine the communication status of the link.

[0080] In an embodiment of the present application, when a PFC storm occurs, the reference switch sends an LLDP packet configuration TLV Type=127 to the target switch. This allows the Option TLV to be filled with customized content, conveying the queue number to be disabled and the action (disable, i.e., the first operation identifier) ​​to the receiving end (i.e., the target switch). Figure 7 is a schematic diagram of a first control instruction according to an embodiment of the present application. As shown in Figure 7, the LLDP packet includes a 16-byte header. 9-byte Chassis ID (Identity document) TLV, such as a MAC (Media Access Control) address or name, has a type code of 1 and a length equal to the total TLV length minus 4. 5-byte Port ID TLV, such as a device's port number or name, has a type code of 2 and a length equal to the total TLV length minus 4. 4-byte Time To Live TLV, which provides the lifetime of an LLDPDU (Link Layer Discovery Protocol Data Unit) (in seconds or minutes, for example), has a type code of 3.

[0081] 14-byte Optional TLVs provide additional information, such as the device type and management IP address. These Optional TLVs include a 1-byte TLV Type, a 1-byte TLV Length, a 3-byte Organization Unique Code, a 1-byte Padding, and an 8-byte Epoch time. The Organization Unique Code field may, but is not limited to, carry the queue number for which the message is to be discarded and the action (enable or disable, i.e., the first action identifier).

[0082] 2-byte End of LLDPDU TLV (end flag of link layer discovery protocol data unit), with type code 0 and length 0. 4-byte FCS (Frame Check Sequence) is used to verify the integrity of the frame.

[0083] In an exemplary embodiment, the first control instruction may be sent to the target switch in the following manner, but is not limited to: the first control instruction is sent by a third transmission module in the reference switch to a fourth transmission module in the target switch via a network controller, wherein the first control instruction includes the IP address of the reference switch, the IP address of the target switch, a first port number of a first port on the reference switch, a second port number of a second port on the target switch, a queue number of a target packet queue, and a first operation identifier, where the first operation identifier is used to perform a discard operation on the packet.

[0084] Optionally, in this embodiment, the reference switch may, but is not limited to, send the IP address of the reference switch, the first port number of the first port on the reference switch, the queue number of the target message queue, and the first operation identifier to a network controller (Controller). The network controller obtains the IP address of the target switch corresponding to the IP (Internet Protocol) address of the reference switch, and obtains the second port number of the second port on the target switch corresponding to the first port number of the first port on the reference switch. The network controller then carries the IP address of the reference switch, the IP address of the target switch, the first port number of the first port on the reference switch, the second port number of the second port on the target switch, the queue number of the target message queue, and the first operation identifier in a first control instruction, and sends the first control instruction to the target switch.

[0085] In an exemplary embodiment, the second control instruction may be sent to the target switch in the following manner, but is not limited to: obtaining a second send quantity corresponding to the target packet queue and recorded in a PFC counter in a reference switch; and sending the second control instruction to the target switch when the second send quantity satisfies a preset second control condition, wherein the second control instruction is used to instruct to perform a retain operation on packets in the target packet queue.

[0086] Optionally, in this embodiment, after sending the first control instruction to the target switch, a second sending quantity corresponding to the target packet queue and recorded in the PFC counter in the reference switch may be obtained, but is not limited to. If the second sending quantity meets a preset second control condition, it may indicate that the PFC storm in the target packet queue on the target switch has disappeared. In this case, a second control instruction may be sent to the target switch, so that the target switch may perform a retention operation on the packets in the target packet queue.

[0087] In an exemplary embodiment, determining whether the second sending quantity satisfies the second control condition may include, but is not limited to, one of the following situations:

[0088] Scenario 1: When the second sending quantity is less than a preset third quantity threshold, it is determined that the second sending quantity meets the second control condition.

[0089] Scenario 2: When it is determined based on the second sending quantity that the number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch within the second preset time period is less than a preset fourth quantity threshold, it is determined that the second sending quantity meets the second control condition.

[0090] Optionally, in this embodiment, the first preset duration and the second preset duration may be, but are not limited to, the same or different.

[0091] In an exemplary embodiment, the second control instruction may be sent to the target switch in the following manner, but is not limited to: sending the second control instruction to the second transmission module in the target switch via a first transmission module in the reference switch, wherein the first transmission module and the second transmission module are connected to a second port on the target switch via a first port on the reference switch, the target packet queue is a packet queue on the second port on the target switch, and the second control instruction includes a queue number of the target packet queue and a second operation identifier, where the second operation identifier is used to perform a retain operation on the packet.

[0092] Optionally, in this embodiment, when the first transmission module in the reference switch and the second transmission module in the target switch are connected through the first port and the second port, it can be indicated that the reference switch and the target switch are directly connected. In this case, the second control instruction can be sent to the second transmission module in the target switch through the first transmission module.

[0093] In an exemplary embodiment, the second control instruction may be sent to the target switch in the following manner, but is not limited to: the second control instruction is sent to the second LLDP module in the target switch via the target transmission link by the first LLDP module in the reference switch, wherein the second control instruction is a message encapsulated in the LLDP transmission format, and the target transmission link is the transmission link between the first port and the second port.

[0094] Optionally, in this embodiment, different ports on the target switch and different ports on the reference switch have different transmission links.

[0095] In an exemplary embodiment, the second control instruction may be sent to the target switch in the following manners, including but not limited to:

[0096] A second control instruction is sent by the third transmission module in the reference switch to the fourth transmission module in the target switch through the network controller, where the second control instruction includes the IP address of the reference switch, the IP address of the target switch, a first port number of a first port on the reference switch, a second port number of a second port on the target switch, a queue number of a target message queue, and a second operation identifier, where the second operation identifier is used to perform a retain operation on the message.

[0097] Optionally, in this embodiment, the reference switch may, but is not limited to, send the IP address of the reference switch, the first port number of the first port on the reference switch, the queue number of the target message queue, and the second operation identifier to a network controller (Controller). The network controller obtains the IP address of the target switch corresponding to the IP (Internet Protocol) address of the reference switch, and obtains the second port number of the second port on the target switch corresponding to the first port number of the first port on the reference switch. The network controller then carries the IP address of the reference switch, the IP address of the target switch, the first port number of the first port on the reference switch, the second port number of the second port on the target switch, the queue number of the target message queue, and the second operation identifier in a first control instruction, and sends the first control instruction to the target switch.

[0098] In an exemplary embodiment, a retain operation may be performed on the message in the target message queue on the second port on the target switch in the following manner, but is not limited to: deleting an ACL rule generated by an access control list (ACL) control module, wherein the ACL rule is used to instruct a discard operation to be performed on the message in the target message queue.

[0099] Optionally, in this embodiment, when the PFC storm disappears, the target switch removes the ACL (Access Control List) rule to restore the PFC behavior, and then performs a retention operation on the messages in the target message queue.

[0100] In an exemplary embodiment, a retain operation may be performed on the packets in the target packet queue on the second port of the target switch in the following manner, but is not limited to: obtaining the second port number, the queue number of the target packet queue, and the second operation identifier from the second control instruction; and performing the retain operation on the packets in the target packet queue on the second port of the target switch, where the second port is the port identified by the second port number, the target packet queue is the packet queue identified by the queue number, and the retain operation is the operation indicated by the second operation identifier.

[0101] Optionally, in this embodiment, the target switch may have, but is not limited to, multiple ports. When the second control instruction sent by the reference switch is obtained, the second port number, the queue number of the target message queue, and the second operation identifier may be obtained from the second control instruction, but is not limited to obtaining the second port number; the second port identified by the second port number is obtained from the multiple ports; the target message queue identified by the queue number is obtained from the multiple queues in the second port; and the retain operation is performed on the message in the target message queue.

[0102] In this embodiment, a method for controlling a switch running on the mobile terminal is provided. FIG8 is a second flow chart of the method for controlling a switch according to an embodiment of the present application. As shown in FIG8 , the flow chart includes the following steps:

[0103] Step S702: Obtain a first control instruction sent by the reference switch, wherein the first control instruction is used to instruct to perform a discard operation on packets in a target packet queue. The first control instruction is a control instruction sent from the reference switch to the target switch when a first sending quantity satisfies a preset first control condition. The target packet queue is a packet queue on the target switch. The first sending quantity is recorded in a priority-based flow control (PFC) counter in the reference switch, and the first sending quantity is the number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch.

[0104] Step S704: In response to the first control instruction, a discard operation is performed on the message in the target message queue on the target switch.

[0105] Through the above steps, when the target switch sends packets to the reference switch, the PFC counter in the reference switch records the number of PFC pause frames sent by the reference switch to the target packet queue of the target switch. If the number of PFC pause frames meets the control condition, it can be indicated that a PFC storm has occurred in the target packet queue on the target switch. In this case, a control instruction is sent to the switch that does not have the PFC counter function, so that the switch that does not have the PFC counter function can promptly discard packets in the congested packet queue, thereby avoiding exacerbating the congestion of the packet queue on the target switch that has experienced a PFC storm. Therefore, the problem of switches that do not have the PFC counter being unable to detect PFC storms can be solved, and the effect of switches that do not have the PFC counter being able to promptly detect PFC storms when a PFC storm occurs can be achieved.

[0106] The execution subject of the above steps may be a terminal, etc., but is not limited thereto.

[0107] The execution order of step S702 and step S704 can be interchanged, that is, step S704 can be executed first, and then step S702.

[0108] In the technical solution provided in step S702 above, when the reference switch determines that a PFC storm occurs in the target packet queue on the target switch based on the first sending quantity, the reference switch may, but is not limited to, send a first control instruction to the target switch.

[0109] In the technical solution provided in step S704 above, when the target switch obtains the first control instruction, it can, but is not limited to, respond to the first control instruction and discard the message in the target message queue, thereby avoiding the collapse and paralysis of the entire link and improving the stability of the transmission link between the switches.

[0110] In an exemplary embodiment, the first control instruction sent by the reference switch can be obtained in the following manner, but is not limited to: obtaining the first control instruction sent by a first port on the reference switch to a second port on the target switch, wherein the first control instruction includes a queue number of a target packet queue and a first operation identifier, the first operation identifier being used to perform a discard operation on the packet, and the target packet queue is a packet queue on the second port on the target switch.

[0111] In an exemplary embodiment, a discard operation may be performed on packets in a target packet queue on a target switch in the following manner, but is not limited to: obtaining a queue number and a first operation identifier of the target packet queue from a first control instruction; and performing a discard operation on packets in the target packet queue on a second port of the target switch, wherein the target packet queue is the packet queue identified by the queue number, and the discard operation is the operation indicated by the first operation identifier.

[0112] In an exemplary embodiment, a discard operation may be performed on packets in a target packet queue on a target switch in the following manner, but is not limited to: generating an access control list (ACL) rule by an ACL control module in the target switch, wherein the ACL rule is used to instruct to discard the packets in the target packet queue; and discarding the packets in the target packet queue according to the ACL rule.

[0113] Optionally, in this embodiment, the packets in the target packet queue can be discarded by, but not limited to, generating ACL rules in the target switch. Figure 9 is a schematic diagram of a method for performing a discard operation on packets in a target packet queue according to an embodiment of the present application. As shown in Figure 9, the connected switch (i.e., the reference switch 202) and the local switch (i.e., the target switch 204) are connected via port 202-5 (i.e., the first port) and port 204-3 (i.e., the second port). The PFC Tx counter monitoring module 202-2 in the connected switch is configured to monitor the PFC send direction PFC counter 202-1 on the queue in the port of the connected switch in real time and record the duration. When the connected switch determines that a PFC storm has occurred in the target packet queue on the local switch, it can, but is not limited to, send a first control command to the local switch via the PFCWD signal sending module through the LLDP module 202-4 (i.e., the first LLDP module mentioned above) via the target transmission link between port 202-5 and port 204-3.

[0114] When LLDP module 204-4 (i.e., the aforementioned second LLDP module) in the local switch receives the first control command, the PFCWD signal receiving module may, but is not limited to, parse the first operation identifier and the queue number of the target packet queue in the first control command. In this case, the ACL control module 204-2 (i.e., the aforementioned access control list (ACL) control module) may be triggered to drop packets in packet queue 2 on port 204-3 by adding rule 1: Drop packets in packet queue 2 on port 204-3.

[0115] It should be noted that the ACL control module 204 - 2 may have other ACL rules, such as: Rule 2: discard the message in the message queue 1 of port 1; Rule 3: discard the message in the message queue 3 of port 1, and so on.

[0116] In an exemplary embodiment, a discard operation may be performed on packets in a target packet queue on a second port of a target switch in the following manner, but is not limited to: generating an access control list (ACL) rule by an ACL control module in the target switch, wherein the ACL rule is used to instruct to discard packets in the target packet queue on the second port; and discarding packets in the target packet queue on the second port according to the ACL rule.

[0117] Optionally, in this embodiment, packets in the target packet queue can be discarded by, but not limited to, generating ACL rules in the target switch. FIG10 is a second schematic diagram of performing a discard operation on packets in the target packet queue according to an embodiment of the present application. As shown in FIG10 , the PFC Tx counter monitoring module 202-7 of the connected switch (i.e., reference switch 202) is configured to monitor the PFC send direction PFC counter 202-1 on the queue of the port in the connected switch in real time and record the duration.

[0118] When the connected switch (i.e., the reference switch 202) determines that a PFC storm has occurred in the target message queue in the second port on the local switch (i.e., the target switch 204), the IP address of the reference switch, the first port number of the first port on the reference switch, the queue number of the target message queue, and the first operation identifier can be sent to the network controller 208 via the management port 202-6 via, but is not limited to, the PFCWD signal sending module 202-8; the network controller 208 obtains the IP address of the target switch corresponding to the IP address of the reference switch, the second port number of the second port on the target switch corresponding to the first port number of the first port, and carries the IP address of the reference switch, the IP address of the target switch, the first port number of the first port on the reference switch, the second port number of the second port on the target switch, the queue number of the target message queue, and the first operation identifier in the first control command.

[0119] The network controller 208 sends a first control command to the local switch through the management port 204-6 on the local switch. Upon receiving the first control command, the PFCWD signal receiving module 204-5 in the local switch parses the second port number of the second port, the queue number of the target packet queue, and the first operation identifier in the first control command, and triggers the ACL control module 204-7 to generate rule 1: discard packets in packet queue 2 (i.e., the target packet queue) on port 2 (i.e., the second port).

[0120] It should be noted that the ACL control module 204 - 2 may generate other ACL rules, such as: Rule 2: discard the message in the message queue 1 of port 1, Rule 3: discard the message in the message queue 3 of port 1, and so on.

[0121] 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 plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the embodiment of the present application is essentially 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, magnetic disk, optical disk), including a number of instructions for enabling a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the method of each embodiment of the present application.

[0122] This embodiment also provides a switch control device configured to implement the aforementioned embodiment and optional implementations. Details already described will not be repeated. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are optionally implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.

[0123] FIG11 is a structural block diagram 1 of a control device for a switch according to an embodiment of the present application. As shown in FIG11 , the device includes:

[0124] A first obtaining module 1102 is configured to obtain a first sending quantity corresponding to a target packet queue recorded in a priority-based flow control (PFC) counter in a reference switch, wherein the first sending quantity is a number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch, where the target packet queue is a packet queue on the target switch;

[0125] The first sending module 1104 is configured to send a first control instruction to the target switch when the first sending quantity meets a preset first control condition, wherein the first control instruction is used to instruct to perform a discard operation on the messages in the target message queue.

[0126] Through the above-mentioned device, when the target switch sends a message to the reference switch, the PFC counter in the reference switch records the number of PFC pause frames sent by the reference switch to the target message queue of the target switch. When the number of PFC pause frames meets the control condition, it can be indicated that a PFC storm has occurred in the target message queue on the target switch. In this case, a control instruction is sent to the switch that does not have the PFC counter function, so that the switch that does not have the PFC counter function can promptly discard the messages in the congested message queue, thereby avoiding exacerbating the congestion of the message queue on the target switch that has experienced the PFC storm. Therefore, the problem that the switch that does not have the PFC counter function cannot detect the PFC storm can be solved, and the effect of the switch that does not have the PFC counter being able to promptly detect the PFC storm when the PFC storm occurs can be achieved.

[0127] In one exemplary embodiment, the apparatus further comprises:

[0128] The first determining module is configured to determine, before sending the first control instruction to the target switch, that the first sending quantity satisfies a first control condition when the first sending quantity is greater than or equal to a preset first quantity threshold; or

[0129] The second determining module is configured to determine that the first sending quantity satisfies the first control condition when, based on the first sending quantity, a number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch within the first preset time period is greater than or equal to a preset second quantity threshold.

[0130] In one exemplary embodiment, the apparatus further comprises:

[0131] The second acquisition module is configured to acquire a last sent quantity, wherein the last sent quantity is a cumulative number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch at a first moment, and the first sent quantity is a cumulative number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch at a second moment, the first moment being earlier than the second moment, and a duration between the first moment and the second moment being a first preset duration;

[0132] The third determining module is configured to determine the difference between the first sent quantity and the last sent quantity as the number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch within the first preset time period.

[0133] In an exemplary embodiment, the first sending module includes:

[0134] The first sending unit is configured to send a first control instruction to a second transmission module in a target switch through a first transmission module in a reference switch, wherein the first transmission module and the second transmission module are connected to a second port on the target switch through a first port on the reference switch, the target packet queue is a packet queue on the second port on the target switch, and the first control instruction includes a queue number of the target packet queue and a first operation identifier, where the first operation identifier is used to perform a discard operation on the packet.

[0135] In an exemplary embodiment, the first sending unit is configured to:

[0136] The first control instruction is sent to the second LLDP module in the target switch through the target transmission link by the first link layer discovery protocol LLDP module in the reference switch, wherein the first control instruction is a message encapsulated in the transmission format of LLDP, and the target transmission link is the transmission link between the first port and the second port.

[0137] In an exemplary embodiment, the first sending module includes:

[0138] The second sending unit is configured to send a first control instruction to the fourth transmission module in the target switch through the network controller via the third transmission module in the reference switch, where the first control instruction includes the IP address of the reference switch, the IP address of the target switch, a first port number of a first port on the reference switch, a second port number of a second port on the target switch, a queue number of a target packet queue, and a first operation identifier, where the first operation identifier is used to perform a discard operation on the packet.

[0139] In one exemplary embodiment, the apparatus further comprises:

[0140] A third acquisition module is configured to acquire a second sending quantity corresponding to the target packet queue recorded in the PFC counter in the reference switch after sending the first control instruction to the target switch;

[0141] The second sending module is configured to send a second control instruction to the target switch when the second sending quantity meets a preset second control condition, wherein the second control instruction is used to instruct to perform a reservation operation on the messages in the target message queue.

[0142] In one exemplary embodiment, the apparatus further comprises:

[0143] a fourth determining module configured to, before sending the second control instruction to the target switch, determine that the second sent quantity satisfies the second control condition when the second sent quantity is less than a preset third quantity threshold; or

[0144] The fifth determining module is configured to determine that the second sending quantity satisfies the second control condition when it is determined based on the second sending quantity that the number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch within the second preset time period is less than a preset fourth quantity threshold.

[0145] In an exemplary embodiment, the second sending module includes:

[0146] The third sending unit is configured to send a second control instruction to a second transmission module in the target switch through the first transmission module in the reference switch, wherein the first transmission module and the second transmission module are connected to the second port on the target switch through the first port on the reference switch, the target message queue is the message queue on the second port on the target switch, and the second control instruction includes a queue number of the target message queue and a second operation identifier, where the second operation identifier is used to perform a retain operation on the message.

[0147] In an exemplary embodiment, the second sending module includes:

[0148] The fourth sending unit is configured to send the second control instruction to the second LLDP module in the target switch through the target transmission link by using the first LLDP module in the reference switch, wherein the second control instruction is a message encapsulated in the LLDP transmission format, and the target transmission link is the transmission link between the first port and the second port.

[0149] In an exemplary embodiment, the second sending module includes:

[0150] The fifth sending unit is configured to send a second control instruction to the fourth transmission module in the target switch through the third transmission module in the reference switch and the network controller, wherein the second control instruction includes the IP address of the reference switch, the IP address of the target switch, a first port number of the first port on the reference switch, a second port number of the second port on the target switch, a queue number of the target message queue, and a second operation identifier, where the second operation identifier is used to perform a retain operation on the message.

[0151] In one exemplary embodiment, the apparatus further comprises:

[0152] a fourth acquisition module configured to, after sending a second control instruction to the target switch, acquire a queue number of the target packet queue and a second operation identifier from the second control instruction, wherein the second control instruction is a control instruction received on the second port;

[0153] The first execution module is configured to perform a retain operation on the messages in the target message queue on the second port on the target switch, wherein the target message queue is the message queue identified by the queue number, and the retain operation is the operation indicated by the second operation identifier.

[0154] In an exemplary embodiment, the first execution module includes:

[0155] The deleting unit is configured to delete an access control list (ACL) rule generated by an ACL control module, wherein the ACL rule is used to instruct to perform a discard operation on a message in a target message queue.

[0156] In one exemplary embodiment, the apparatus further comprises:

[0157] a fifth obtaining module configured to obtain the second port number, the queue number of the target packet queue, and the second operation identifier from the second control instruction after sending the second control instruction to the target switch;

[0158] The second execution module is configured to perform a retain operation on the message in the target message queue on the second port on the target switch, wherein the second port is a port identified by the second port number, the target message queue is a message queue identified by the queue number, and the retain operation is an operation indicated by the second operation identifier.

[0159] FIG12 is a second structural block diagram of a control device for a switch according to an embodiment of the present application. As shown in FIG12 , the device includes:

[0160] a sixth obtaining module 1202 configured to obtain a first control instruction sent by the reference switch, wherein the first control instruction is used to instruct to perform a discard operation on packets in a target packet queue, the first control instruction being a control instruction sent from the reference switch to the target switch when a first sending quantity satisfies a preset first control condition, the target packet queue being a packet queue on the target switch, the first sending quantity being recorded in a priority-based flow control (PFC) counter in the reference switch, and the first sending quantity being the number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch;

[0161] The third execution module 1204 is configured to respond to the first control instruction and execute a discard operation on the message in the target message queue on the target switch.

[0162] Through the above-mentioned device, when the target switch sends a message to the reference switch, the PFC counter in the reference switch records the number of PFC pause frames sent by the reference switch to the target message queue of the target switch. When the number of PFC pause frames meets the control condition, it can be indicated that a PFC storm has occurred in the target message queue on the target switch. In this case, a control instruction is sent to the switch that does not have the PFC counter function, so that the switch that does not have the PFC counter function can promptly discard the messages in the congested message queue, thereby avoiding exacerbating the congestion of the message queue on the target switch that has experienced the PFC storm. Therefore, the problem that the switch that does not have the PFC counter function cannot detect the PFC storm can be solved, and the effect of the switch that does not have the PFC counter being able to promptly detect the PFC storm when the PFC storm occurs can be achieved.

[0163] In an exemplary embodiment, the sixth obtaining module is configured to obtain a first control instruction sent by a first port on a reference switch to a second port on a target switch, wherein the first control instruction includes a queue number of a target packet queue and a first operation identifier, the first operation identifier being used to perform a discard operation on the packet, and the target packet queue is a packet queue on the second port on the target switch;

[0164] The third execution module is configured to obtain a queue number and a first operation identifier of a target message queue from the first control instruction; and perform a discard operation on messages in the target message queue on the second port of the target switch, wherein the target message queue is the message queue identified by the queue number, and the discard operation is the operation indicated by the first operation identifier.

[0165] In an exemplary embodiment, the third execution module includes:

[0166] A first generating unit is configured to generate an access control list (ACL) rule through an access control list (ACL) control module in a target switch, wherein the ACL rule is used to instruct to perform a discard operation on a message in a target message queue;

[0167] The first execution unit is configured to execute a discard operation on the message in the target message queue according to the ACL rule.

[0168] In an exemplary embodiment, the sixth acquisition module is configured to acquire a first control instruction sent by the third transmission module in the reference switch to the fourth transmission module in the target switch via the network controller, wherein the first control instruction includes an IP address of the reference switch, an IP address of the target switch, a first port number of a first port on the reference switch, a second port number of a second port on the target switch, a queue number of a target packet queue, and a first operation identifier, wherein the first operation identifier is used to perform a discard operation on the packet, and the target packet queue is a packet queue on the second port on the target switch;

[0169] The third execution module is configured to obtain a second port number, a queue number of a target message queue, and a first operation identifier from the first control instruction; and perform a discard operation on the message in the target message queue on the second port of the target switch, wherein the second port is a port identified by the second port number, the target message queue is a message queue identified by the queue number, and the discard operation is the operation indicated by the first operation identifier.

[0170] In an exemplary embodiment, the third execution module includes:

[0171] A second generating unit is configured to generate an access control list (ACL) rule through an access control list (ACL) control module in the target switch, wherein the ACL rule is used to instruct to perform a discard operation on the message in the target message queue on the second port;

[0172] The first execution unit is configured to perform a discard operation on the packets in the target packet queue on the second port according to the ACL rule.

[0173] It should be noted that the above modules can be implemented through software or hardware. For the latter, it can be implemented in the following ways, but not limited to: the above modules are all located in the same processor; or the above modules are located in different processors in any combination.

[0174] An embodiment of the present application further provides a non-volatile readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any of the above method embodiments when running.

[0175] In an exemplary embodiment, the non-volatile readable storage medium may include, but is not limited to, various media that can store computer programs, such as 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.

[0176] An embodiment of the present application further provides an electronic device, comprising 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 one of the above method embodiments.

[0177] In an exemplary embodiment, 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.

[0178] For optional examples in this embodiment, reference may be made to the examples described in the above embodiments and exemplary implementations, and this embodiment will not be described in detail here.

[0179] Obviously, those skilled in the art should understand that the various modules or steps of the above-mentioned embodiments of the present application can be implemented using a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented using program codes executable by the 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 performed in a different order than 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 embodiments of the present application are not limited to any specific combination of hardware and software.

[0180] The above are only optional embodiments of the present application and are not intended to limit the embodiments of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modifications, equivalent replacements, improvements, etc. made within the principles of the embodiments of the present application shall be included in the scope of protection of the embodiments of the present application.

Claims

1. A method for controlling a switch, It is characterized in that include: Obtaining a first sending quantity corresponding to a target message queue recorded in a priority-based flow control PFC counter in a reference switch, wherein the first sending quantity is the number of PFC pause frames corresponding to the target message queue sent by the reference switch to the target switch, and the target message queue is a message queue on the target switch; When the first sending quantity meets a preset first control condition, a first control instruction is sent to the target switch, wherein the first control instruction is used to instruct to perform a discard operation on the messages in the target message queue.

2. The method according to claim 1, It is characterized in that Before sending the first control instruction to the target switch, the method further includes: When the first sending quantity is greater than or equal to a preset first quantity threshold, determining that the first sending quantity satisfies the first control condition; or When it is determined according to the first sending quantity that the number of PFC pause frames corresponding to the target message queue sent by the reference switch to the target switch within a first preset time period is greater than or equal to a preset second number threshold, it is determined that the first sending quantity satisfies the first control condition.

3. The method according to claim 2, It is characterized in that The method further comprises: Obtaining a last sent quantity, wherein the last sent quantity is a cumulative quantity of PFC pause frames corresponding to the target message queue sent by the reference switch to the target switch at a first moment, the first sent quantity is a cumulative quantity of PFC pause frames corresponding to the target message queue sent by the reference switch to the target switch at a second moment, the first moment is earlier than the second moment, and the duration between the first moment and the second moment is the first preset duration; The difference between the first sent quantity and the last sent quantity is determined as the quantity of PFC pause frames corresponding to the target message queue sent by the reference switch to the target switch within the first preset time period.

4. The method according to claim 1, It is characterized in that The sending a first control instruction to the target switch includes: The first control instruction is sent to the second transmission module in the target switch through the first transmission module in the reference switch, wherein the first transmission module and the second transmission module are connected to the second port on the target switch through the first port on the reference switch, the target message queue is the message queue on the second port on the target switch, and the first control instruction includes a queue number and a first operation identifier of the target message queue, and the first operation identifier is used to perform the discard operation on the message.

5. The method according to claim 4, It is characterized in that The sending the first control instruction to the second transmission module in the target switch through the first transmission module in the reference switch includes: The first control instruction is sent to the second LLDP module in the target switch through the target transmission link by the first link layer discovery protocol LLDP module in the reference switch, wherein the first control instruction is a message encapsulated in the transmission format of LLDP, and the target transmission link is a transmission link between the first port and the second port.

6. The method according to claim 1, It is characterized in that The sending a first control instruction to the target switch includes: The first control instruction is sent to the fourth transmission module in the target switch through the third transmission module in the reference switch via the network controller, wherein the first control instruction includes the IP address of the reference switch, the IP address of the target switch, the first port number of the first port on the reference switch, the second port number of the second port on the target switch, the queue number of the target message queue, and a first operation identifier, and the first operation identifier is used to perform the discard operation on the message.

7. The method according to any one of claims 1 to 6, It is characterized in that After sending the first control instruction to the target switch, the method further comprises: Obtaining a second sending quantity corresponding to the target message queue and recorded in the PFC counter in the reference switch; When the second sending quantity meets a preset second control condition, a second control instruction is sent to the target switch, wherein the second control instruction is used to instruct to perform a reservation operation on the messages in the target message queue.

8. The method according to claim 7, It is characterized in that Before sending the second control instruction to the target switch, the method further includes: When the second sending quantity is less than a preset third quantity threshold, determining that the second sending quantity satisfies the second control condition; or When it is determined according to the second sending quantity that the number of PFC pause frames corresponding to the target message queue sent by the reference switch to the target switch within a second preset time period is less than a preset fourth quantity threshold, it is determined that the second sending quantity satisfies the second control condition.

9. The method according to claim 7, It is characterized in that The sending the second control instruction to the target switch includes: The second control instruction is sent to the second transmission module in the target switch through the first transmission module in the reference switch, wherein the first transmission module and the second transmission module are connected to the second port on the target switch through the first port on the reference switch, the target message queue is the message queue on the second port on the target switch, and the second control instruction includes a queue number of the target message queue and a second operation identifier, and the second operation identifier is used to perform the reservation operation on the message.

10. The method according to claim 9, It is characterized in that The sending the second control instruction to the target switch includes: The second control instruction is sent to the second LLDP module in the target switch through the target transmission link by the first LLDP module in the reference switch, wherein the second control instruction is a message encapsulated in the transmission format of LLDP, and the target transmission link is a transmission link between the first port and the second port.

11. The method according to claim 7, It is characterized in that The sending the second control instruction to the target switch includes: The second control instruction is sent to the fourth transmission module in the target switch through the third transmission module in the reference switch via the network controller, wherein the second control instruction includes the IP address of the reference switch, the IP address of the target switch, the first port number of the first port on the reference switch, the second port number of the second port on the target switch, the queue number of the target message queue, and a second operation identifier, and the second operation identifier is used to perform the reservation operation on the message.

12. The method according to claim 7, It is characterized in that After sending the second control instruction to the target switch, the method further includes: Acquire the queue number and the second operation identifier of the target message queue from the second control instruction, wherein the second control instruction is a control instruction received on the second port; The reservation operation is performed on the messages in the target message queue on the second port on the target switch, wherein the target message queue is the message queue identified by the queue number, and the reservation operation is the operation indicated by the second operation identifier.

13. The method according to claim 12, It is characterized in that The performing the reservation operation on the message in the target message queue on the second port on the target switch includes: The ACL rule generated by the access control list ACL control module is deleted, wherein the ACL rule is used to instruct to perform the discard operation on the message in the target message queue.

14. The method according to claim 11, It is characterized in that After sending the second control instruction to the target switch, the method further includes: Acquire the second port number, the queue number of the target message queue, and the second operation identifier from the second control instruction; The reservation operation is performed on the message in the target message queue on the second port on the target switch, wherein the second port is the port identified by the second port number, the target message queue is the message queue identified by the queue number, and the reservation operation is the operation indicated by the second operation identifier.

15. A method for controlling a switch, It is characterized in that include: Obtain a first control instruction sent by a reference switch, wherein the first control instruction is used to instruct to perform a discard operation on a message in a target message queue, the first control instruction is a control instruction sent from the reference switch to the target switch when a first sending quantity meets a preset first control condition, the target message queue is a message queue on the target switch, the first sending quantity is recorded in a priority-based flow control PFC counter in the reference switch, and the first sending quantity is a number of packets sent by the reference switch to the target switch. The number of PFC pause frames corresponding to the target message queue sent by the target switch; In response to the first control instruction, the discard operation is performed on the message in the target message queue on the target switch.

16. The method according to claim 15, It is characterized in that The obtaining of the first control instruction sent by the reference switch includes: obtaining a first control instruction sent by a first port on the reference switch to a second port on the target switch, wherein the first control instruction includes a queue number and a first operation identifier of the target message queue, the first operation identifier is used to perform the discard operation on the message, and the target message queue is a message queue on the second port on the target switch; The performing the discard operation on the messages in the target message queue on the target switch includes: acquiring a queue number and a first operation identifier of the target message queue from the first control instruction; and performing the discard operation on the messages in the target message queue on the second port on the target switch, wherein the target message queue is a message queue identified by the queue number, and the discard operation is an operation indicated by the first operation identifier.

17. The method according to claim 16, It is characterized in that The performing the discarding operation on the message in the target message queue on the target switch includes: Generate an ACL rule through an access control list (ACL) control module in the target switch, wherein the ACL rule is used to instruct to perform the discard operation on the message in the target message queue; The discard operation is performed on the messages in the target message queue according to the ACL rule.

18. The method according to claim 15, It is characterized in that The obtaining of the first control instruction sent by the reference switch includes: obtaining a first control instruction sent by the third transmission module in the reference switch to the fourth transmission module in the target switch through the network controller, wherein the first control instruction includes the IP address of the reference switch, the IP address of the target switch, the first port number of the first port on the reference switch, the second port number of the second port on the target switch, the queue number of the target message queue, and a first operation identifier, wherein the first operation identifier is used to perform the discard operation on the message, and the target message queue is the message queue on the second port on the target switch; The performing the discard operation on the message in the target message queue on the target switch includes: acquiring the second port number, the queue number of the target message queue and the first operation identifier from the first control instruction; performing the discard operation on the message in the target message queue on the second port of the target switch, wherein the second port is a port identified by the second port number, the target message queue is a message queue identified by the queue number, and the discard operation is an operation indicated by the first operation identifier.

19. The method according to claim 18, It is characterized in that The performing the discard operation on the message in the target message queue on the second port on the target switch includes: Generate an ACL rule through an access control list (ACL) control module in the target switch, wherein the ACL rule is used to instruct to perform the discard operation on the message in the target message queue on the second port; The discard operation is performed on the messages in the target message queue on the second port according to the ACL rule.

20. A control device for a switch, It is characterized in that include: A first acquisition module is configured to acquire a first sending quantity corresponding to a target message queue recorded in a priority-based flow control PFC counter in a reference switch, wherein the first sending quantity is a quantity of PFC pause frames corresponding to the target message queue sent by the reference switch to the target switch, and the target message queue is a message queue on the target switch; The first sending module is configured to send a first control instruction to the target switch when the first sending quantity meets a preset first control condition, wherein the first control instruction is used to instruct to perform a discard operation on the messages in the target message queue.

21. A control device for a switch, It is characterized in that include: The sixth acquisition module is configured to acquire a first control instruction sent by the reference switch, wherein the first control instruction is used to instruct to perform a discard operation on the message in the target message queue, the first control instruction is a control instruction sent from the reference switch to the target switch when the first sending quantity meets a preset first control condition, and the target message queue is a message queue on the target switch. The first sending quantity is recorded in a priority-based flow control PFC counter in the reference switch, and the first sending quantity is the number of PFC pause frames corresponding to the target packet queue sent by the reference switch to the target switch; The third execution module is configured to respond to the first control instruction and execute the discard operation on the message in the target message queue on the target switch.

22. A non-volatile readable storage medium, It is characterized in that The non-volatile readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the method described in any one of claims 1 to 14 are implemented, or the steps of the method described in any one of claims 15 to 19 are implemented.

23. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the processor implements the steps of the method described in any one of claims 1 to 14, or implements the steps of the method described in any one of claims 15 to 19.

Citation Information

Patent Citations

  • Congestion control method and message processing device

    CN102611620A

  • PFC back-pressure message and processing method thereof

    CN112565087A

  • Data stream processing method, network node and system

    CN115473851A

  • Switch control method and device, storage medium and electronic device

    CN115883466A

  • Flow control technologies

    US20210320866A1