Switch link switching method, electronic equipment, storage medium and program product
By monitoring fault information through the hardware module and reporting it directly to the driver software module, the driver software module selects a backup link and updates the hardware forwarding table entries, which solves the problems of slow network convergence and packet loss during switch link switching, and achieves fast switching and stable network status.
Patent Information
- Application Number
- CN202511430510.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-09
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2045-10-09
AI Technical Summary
Existing switch link switching methods suffer from slow network convergence and high packet loss, especially when link failures occur, leading to network instability.
The hardware module monitors the link status and reports fault information directly to the driver software module. The driver software module selects a backup link based on preset rules and calls the software development kit to update the hardware forwarding table entries, skipping redundant protocol layer processes and achieving fast link switching.
It shortens network convergence time, reduces packet loss, ensures network stability and service continuity, and improves the accuracy and timeliness of link fault identification.
Smart Images

Figure CN120896840A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of network communication technology, and more specifically, to a switch link switching method, electronic device, storage medium, and program product. Background Technology
[0002] In current network communication systems, switches, as crucial forwarding devices, forward network packets through the collaborative work of hardware and software modules. To meet high reliability requirements, multi-link (e.g., dual-link, multi-link redundancy) or dual-machine redundancy architectures are widely used—that is, multiple physical links are deployed between switches (e.g., link a and link b between switches SW1 and SW2), enhancing network fault tolerance through a "primary / backup link" mechanism: under normal conditions, the primary link (e.g., link a) is active, handling all service packet forwarding, while the backup link (e.g., link b) is inactive (port blocked), with no service traffic transmission; when the primary link fails (e.g., physical disconnection, high forwarding error rate), switching to the backup link is required to restore service communication. However, the switch link switching methods in related technologies suffer from problems such as slow network convergence and high packet loss. Summary of the Invention
[0003] The purpose of this application is to provide a switch link switching method, electronic device, storage medium, and program product to achieve the technical effects of fast link switching and preventing packet loss.
[0004] The first aspect of this application provides a switch link switching method, which is applied to a multi-link network device. The network device includes a hardware module, a driver software module, a software development kit, and multiple switch links. Each switch link is equipped with a transmitting switch and a receiving switch, and each transmitting switch is configured with an output interface corresponding to each switch link. The method includes: During the process of the network device forwarding packets using the first link among multiple switch links, if it is determined that the first link has failed based on the first link status data monitored by the hardware module, the hardware module is controlled to send the fault information to the driver software module. The control software module identifies the first outgoing interface associated with the first link on the sending end switch based on the fault information. The first outgoing interface is the packet forwarding exit of the first link. The control software module determines a second outgoing interface to replace the first outgoing interface from multiple outgoing interfaces of the transmitting switch based on preset link configuration rules. The second outgoing interface is associated with a second link among multiple switch links. The driver software module calls the software development kit to send a forwarding table entry switching instruction to the hardware module. The forwarding table entry switching instruction is used to instruct the hardware module to update the hardware table entry for packet forwarding from the first outgoing interface and the first link to the second outgoing interface and the second link, and to forward packets using the second link and the second outgoing interface.
[0005] In the above implementation process, after hardware monitoring for faults, the driver software module directly calls the software development kit to update the hardware forwarding table, skipping the redundant process of prioritizing traditional protocol layer processing, realizing rapid switching from faulty links to backup links, solving the problems of slow network convergence and high packet loss, and ensuring the continuity of basic forwarding services of multi-link switches.
[0006] Further, the first link status data includes the physical layer connectivity signal of the first link, packet forwarding error rate data, or link latency data; if the first link is determined to have failed based on the first link status data monitored by the hardware module, then controlling the hardware module to send the fault information to the driver software module includes: If the hardware module detects that the physical layer connectivity signal of the first link is disconnected, the packet forwarding error rate data exceeds the preset error rate threshold, or the link delay data exceeds the delay threshold, it determines that the first link has failed and controls the hardware module to send the fault information to the driver software module.
[0007] In the above implementation process, by clarifying the specific types of the first link status data (physical layer on / off signals, packet forwarding error rate, link delay) and the rule of determining faults by triggering any indicator threshold, misjudgment or omission caused by ambiguous fault judgment standards is avoided, thereby improving the accuracy and timeliness of link fault identification.
[0008] Furthermore, the preset link configuration rules include: bandwidth priority of each switch link and historical link stability score.
[0009] In the above implementation process, by clearly defining the preset link configuration rules based on bandwidth priority and historical link stability score, it is ensured that when selecting a backup link, the driver software module can prioritize the selection of a link with higher bandwidth and more stable historical operation as the second link. This avoids the decline in link transmission performance or failure again after switching due to blindly selecting a backup link, and ensures the efficiency and stability of service packet forwarding after switching.
[0010] Furthermore, the forwarding table entry switching instruction includes the physical identifier of the second outgoing interface, the logical link identifier of the second link, and the table entry update execution flag.
[0011] In the above implementation process, by explicitly including the physical identifier of the second outgoing interface, the logical identifier of the second link, and the execution flag of the table update in the forwarding table entry switching instruction, it is ensured that the hardware module can accurately identify the target outgoing interface and link to be switched, as well as the execution time of the table update, so as to avoid problems such as switching misalignment and delayed execution caused by incomplete instruction information, thereby improving the accuracy and efficiency of hardware table entry switching and further shortening the convergence time.
[0012] Furthermore, the network device further includes a protocol software module; the method further includes: The driver software module sends the fault information and the second link activation status information to the protocol software module, so that the protocol software module updates the network topology and sends the updated topology information to the driver software module. The updated topology information is used to instruct the driver software module to update the configuration information of the hardware module. The configuration information includes link priority data, backup link redundancy identifier, and interface status synchronization data.
[0013] In the above implementation process, by supplementing the protocol software module and driver synchronization information - protocol update topology - driver completes hardware configuration, on the basis of driver-prioritized fast hardware switching, it ensures that the network topology and hardware configuration are consistent, solves the problem of network state chaos that may be caused by directly switching hardware without skipping the protocol layer, achieves the dual goals of fast switching and network stability, and provides clear guidance for hardware configuration completion by clarifying the specific content of the configuration information.
[0014] Furthermore, the protocol software module updates the network topology through the following steps: Based on the fault information, the first link is marked as faulty, and based on the second link activation status information, the second link is marked as available. Based on the pre-stored connection relationships of each switch port in the protocol software module, the fault status of the first link, and the availability status of the second link, an updated network topology diagram is generated. The updated network topology diagram is synchronized to the driver software module.
[0015] In the above implementation process, by refining the three-step process of "marking status - generating topology map - synchronizing drive" for updating network topology by the protocol software module, and combining it with the pre-stored switch port connection relationship, it is ensured that the protocol layer can accurately and efficiently complete the network topology update, avoid topology errors or update delays caused by ambiguity in the topology update logic, provide accurate topology basis for the driver software module to complete the hardware configuration, and further ensure the consistency of network status.
[0016] Furthermore, the driver software module updates the configuration information of the hardware module through the following steps: The updated link priority data, backup link redundancy identifier, and interface status are synchronized to the hardware module after the network topology update.
[0017] In the above implementation process, by clearly defining the specific content of the hardware configuration update driven by the software module (i.e., link priority, backup link redundancy identifier, interface status), it is ensured that the hardware module can fully synchronize the updated topology information of the protocol layer, cover the historical redundant configuration, avoid forwarding anomalies caused by conflicts between the old configuration and the new topology, further consolidate the foundation of network status consistency, and ensure the long-term stable operation of the link after the switch.
[0018] Furthermore, the method also includes: If the first link status data exceeds a preset fault proximity threshold and it is determined based on the first link status data that the first link is not completely faulty, then the driver software module is controlled to call the software development kit to send a hardware entry configuration instruction to the hardware module; the hardware entry configuration instruction is used to instruct the hardware module to retain hardware entries for both the first output interface and the second output interface.
[0019] In the above implementation process, a fault prediction mechanism is used to retain the primary and backup outgoing interface entries when a new link is about to fail. The backup entries are configured in advance when the link is not completely failed, so that the switch can be completed immediately without regenerating the entries when the link is completely failed, further shortening the disconnection time.
[0020] Furthermore, the fault information includes the identifier of the first link, the fault type, and the timestamp of the fault occurrence.
[0021] In the above implementation process, by clearly defining the fault information, including link identifier, fault type, and timestamp, complete information is provided for the protocol software module to accurately locate the faulty link and select a targeted recovery strategy. At the same time, it provides reliable data support for subsequent network fault tracing and analysis, making it easier for operation and maintenance personnel to investigate the cause of the fault.
[0022] A second aspect of this application provides an electronic device, the electronic device comprising: processor; Memory used to store processor-executable instructions; Wherein, when the processor invokes the executable instructions, it implements any of the methods described in the first aspect.
[0023] A third aspect of this application provides a computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of any of the methods described in the first aspect.
[0024] A fourth aspect of this application provides a computer program product, the computer program product including a computer program, which, when executed by a processor, implements any of the methods described in the first aspect. Attached Figure Description
[0025] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0026] Figure 1 A flowchart illustrating a switch link switching method provided in an embodiment of this application; Figure 2 A diagram illustrating normal forwarding and hardware entry generation of a switch's primary and backup links is provided in this application embodiment. Figure 3 A hardware entry switching diagram for triggering a main link failure in a switch is provided in an embodiment of this application. Figure 4 This application provides a diagram illustrating protocol synchronization and hardware configuration completion after a switch link switchover. Figure 5 This is a structural block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0027] The technical solutions in the embodiments of this application will now be described with reference to the accompanying drawings.
[0028] It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. Furthermore, in the description of this application, terms such as "first," "second," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0029] Current network switches forward network packets through a combination of software and hardware. When high reliability is required, dual-link or dual-machine redundancy is necessary to enhance network reliability. When a link or device fails, traffic can be switched through primary / backup failover.
[0030] However, the relevant switch link switching technology has the following defects, resulting in slow convergence and high packet loss during multi-link switch fault switching: (1) Long convergence time: The relevant technology requires the hardware module to report the fault information to the protocol software module first. After the protocol software module updates the network topology and recalculates the forwarding path, it sends the new path to the driver software module. Finally, the driver software module controls the hardware module to update the forwarding rules. The "protocol layer priority processing" logic in the whole process causes the hardware module to be unable to update the table entries in time. The interruption time usually exceeds 100ms, which can easily cause a large number of service packets to be lost. (2) Lack of fault prediction mechanism: The relevant technology only triggers the handover after the link is completely failed, without considering the scenario where the link index is close to the fault threshold but has not completely failed, and cannot further shorten the handover delay.
[0031] To address the aforementioned shortcomings, this application proposes a logic of hardware-priority monitoring, driver-priority switching, and protocol-based post-synchronization, combined with a fault prediction mechanism, to achieve rapid convergence and network stability. When a switch link fails or is about to fail, the packet forwarding path is quickly switched and optimized to shorten network convergence time, prevent service packet loss, and ensure network consistency.
[0032] Based on this, embodiments of this application provide a switch link switching method, referring to... Figure 1 , Figure 1 This is a flowchart illustrating a switch link switching method provided in an embodiment of this application.
[0033] In this embodiment, the method is applied to a multi-link network device. The network device includes a hardware module, a driver software module, a software development kit, and multiple switch links. Each switch link is equipped with a transmitting switch and a receiving switch. Each transmitting switch is configured with an outgoing interface corresponding to each switch link. The method includes: Step S10: During the process of the network device forwarding packets using the first link among the multiple switch links, if it is determined that the first link has failed based on the first link status data monitored by the hardware module, then the hardware module is controlled to send the fault information to the driver software module. It should be noted that multi-link network devices refer to communication devices that deploy at least two switch links, including but not limited to enterprise-level switches and data center switches. Their typical architecture is a dual-device dual-link “sending switch - receiving switch” (e.g., SW1 is the sending switch and SW2 is the receiving switch, with link a and link b deployed between them). The sending switch is the output end of the message and is configured with the corresponding output interface for each link; the receiving switch is the input end of the message, and the two work together to achieve link redundancy.
[0034] Hardware modules refer to physical components (such as switching chips and port controllers) in network devices that are responsible for physical layer link status monitoring, packet forwarding, and hardware entry storage. They can collect data such as link connectivity and forwarding error rate in real time and perform hardware entry updates.
[0035] The driver software module is middleware that sits between the hardware module and the protocol software module. It is responsible for receiving fault information from the hardware module, parsing protocol layer instructions, and calling the software development kit (SDK) to control the table configuration of the hardware module.
[0036] A software development kit (SDK) is a set of programming interfaces provided by hardware manufacturers. Driver software modules configure and control hardware modules by calling the SDK's interfaces (such as table entry writing interfaces and status reading interfaces).
[0037] A switch link refers to a physical communication link connecting a sending switch and a receiving switch. Each link corresponds to an "outgoing interface" of the sending switch (e.g., link a corresponds to outgoing interface 1 of SW1, and link b corresponds to outgoing interface 2 of SW1).
[0038] The outgoing interface refers to the physical port on the sending switch used for packet forwarding. It corresponds one-to-one with the switch link and is the identifier of "packet exit" in the hardware table.
[0039] Fault information refers to information generated by the hardware module that includes link fault identifiers, fault types, etc., and is used to drive the software module to identify faulty links. For example, the fault information content includes "Link a (first link) is physically disconnected".
[0040] Specifically, when a network device forwards a packet through the first link (e.g., link a), the first outgoing interface (port 1 of SW1) is activated, while the second outgoing interface (port 2 of SW1) of the second link (e.g., backup link b) is blocked. The hardware module's hardware entry is configured as "Outgoing 1 → Link a", and packets are forwarded according to this entry. The hardware module collects the status data of the first link in real time (e.g., physical layer connectivity signal, forwarding error rate, etc.). If the hardware module determines that the first link has failed (e.g., the physical layer connectivity signal is disconnected), it sends the fault information (including link identifier and fault type) to the driver software module, enabling rapid fault detection.
[0041] It should be understood that controlling the hardware module does not refer to an additional external control entity. The hardware module does not require external control; it will actively monitor and report. The essence of "control" is the manifestation of the hardware module autonomously executing according to preset logic.
[0042] Step S20: Control the driver software module to identify the first outgoing interface associated with the first link on the sending end switch based on the fault information. The first outgoing interface is the packet forwarding exit of the first link. It should be noted that the first outgoing interface is the outgoing interface corresponding to the first link (i.e., the primary link) (e.g., link a corresponds to port 1 of SW1); the second outgoing interface is the outgoing interface corresponding to the second link (i.e., the backup link) (e.g., link b corresponds to port 2 of SW1). The two are in a primary-backup replacement relationship.
[0043] Specifically, after receiving the fault information, the driver software module identifies the first outgoing interface (outgoing interface 1) associated with the first link on the sending switch through the pre-stored link-outgoing interface mapping table (such as the mapping table indicating "link a → outgoing interface 1"), and clarifies the packet forwarding exit corresponding to the faulty link.
[0044] Step S30: Control the driver software module to determine a second outgoing interface to replace the first outgoing interface from multiple outgoing interfaces of the sending end switch based on preset link configuration rules. The second outgoing interface is associated with a second link among multiple switch links. It should be noted that the preset link configuration rule refers to the backup outgoing interface selection logic pre-configured in the driver software module. Its core is to determine the backup outgoing interface from multiple outgoing interfaces when the primary link fails. Optionally, the primary link corresponds to the primary outgoing interface, and the backup link corresponds to the backup outgoing interface (i.e., fixed primary-backup mapping). For example, traffic from sw1 to sw2 travels through link a, meaning the outgoing interface is port 1, and its backup interface is port 2. The preset link configuration rule is: "The backup link for link a (the first link) is link b (the second link), and the backup interface for outgoing interface 1 is outgoing interface 2." This rule eliminates the need for complex calculations, directly determining the backup based on the pre-configured primary-backup relationship to achieve rapid link switching, shorten convergence time, and avoid the latency of recalculating paths at the traditional protocol layer.
[0045] Specifically, based on the above rules, the driver software module directly locates the backup outgoing interface (port 2) of the first outgoing interface (port 1), i.e., the second outgoing interface, from multiple outgoing interfaces of the sending-end switch (such as port 1 and port 2 of SW1); this second outgoing interface is associated with the second link (link b). This process embodies the "primary switchover" logic, that is, after link a fails, port 2 corresponding to link b is directly activated without additional topology calculation.
[0046] Step S40: Control the driver software module to call the software development kit to send a forwarding table entry switching instruction to the hardware module. The forwarding table entry switching instruction is used to instruct the hardware module to update the hardware table entry for packet forwarding from the first outgoing interface and the first link to the second outgoing interface and the second link, and use the second link and the second outgoing interface to forward packets.
[0047] It should be noted that the forwarding table entry switching instruction is an instruction issued by the driver software module to the hardware module through the SDK. Its function is to update the forwarding exit of the hardware table entry, that is, to switch from the first outgoing interface-first link to the second outgoing interface-second link.
[0048] Hardware entries refer to the forwarding rule table stored in the hardware module. They record which outgoing interface a packet needs to be forwarded from and which link it needs to pass through. They are the direct basis for the hardware module to guide packet forwarding.
[0049] It should be understood that since the link failure is detected first by the driver software module, it can directly send a message to the hardware module to forcibly update the hardware table entry to output 2. This is much faster than first reporting the link failure, updating the protocol, sending the message to the driver software module, and then updating the hardware table entry. The driver software module bypasses the protocol software module and directly calls the software development kit, skipping the traditional protocol-first redundant process and accelerating convergence.
[0050] The function of the forwarding table entry switching instruction is as follows: This instruction includes information about the target outgoing interface (e.g., port 2) and the target link (e.g., link b), essentially driving the SDK to write the specific implementation of the hardware. After receiving this instruction, the hardware module will immediately update its stored hardware table entries (which are used to guide packet forwarding) – from the original "first outgoing interface 1 → first link a" to "second outgoing interface 2 → second link b".
[0051] After the hardware entries are updated, the hardware module directly forwards packets according to the new entries—that is, forwards them to the receiving switch SW2 via the second outgoing interface (port 2) and the second link (link b), thus achieving rapid recovery of service traffic. Compared to traditional solutions that require waiting for protocol layer processing, this embodiment directly operates the hardware through the driver, minimizing the interruption time and preventing packet loss.
[0052] In this embodiment, after hardware detection of a fault, the driver software module directly calls the software development kit to update the hardware forwarding table, skipping the redundant process of prioritizing traditional protocol layer processing, and realizing a rapid switch from the faulty link to the backup link. This solves the problems of slow network convergence and high packet loss, and ensures the continuity of basic forwarding services of multi-link switches.
[0053] Based on any of the above embodiments, the first link status data includes the physical layer connectivity signal of the first link, packet forwarding error rate data, or link latency data; the step of controlling the hardware module to send fault information to the driver software module if it is determined that the first link has failed based on the first link status data monitored by the hardware module includes: If the hardware module detects that the physical layer connectivity signal of the first link is disconnected, the packet forwarding error rate data exceeds the preset error rate threshold, or the link delay data exceeds the delay threshold, it determines that the first link has failed and controls the hardware module to send the fault information to the driver software module.
[0054] It should be noted that the first link status data refers to the parameters obtained by the hardware module monitoring the first link, including but not limited to the following three categories: Physical layer connectivity signals: Electrical signals indicating whether the physical layer of the link is properly connected (e.g., "high level" indicates connection, "low level" indicates disconnection); Message forwarding error rate data: The percentage of erroneous messages (such as CRC errors and frame alignment errors) in the first link forwarding messages per unit time; Link delay data: The average time it takes for a message to travel from the sending switch to the receiving switch via the first link.
[0055] Understandably, the preset error rate threshold and latency threshold are fault judgment thresholds pre-configured according to business needs. Optionally, the error rate threshold is 1% and the latency threshold is 100ms.
[0056] Specifically, the hardware module determines the first link failure using any of the following logic: If the physical layer connectivity signal is detected to be disconnected (e.g., link a is accidentally plugged or unplugged), a fault is directly determined. If the physical layer on / off signal is normal, but the packet forwarding error rate exceeds the preset error rate threshold (e.g., the error rate reaches 2% within 1 minute), a fault is determined. If the link latency exceeds the latency threshold (e.g., average latency reaches 150ms), a fault is identified. If any of the above conditions are met, the hardware module will immediately send the fault information to the driver software module.
[0057] In this embodiment, by clearly defining the specific type of the first link status data (physical layer on / off signal, packet forwarding error rate, link delay) and the rule of determining faults by triggering any indicator threshold, misjudgment or omission caused by ambiguous fault judgment criteria is avoided, thereby improving the accuracy and timeliness of link fault identification.
[0058] Based on any of the above embodiments, the preset link configuration rules include: bandwidth priority of each switch link and historical link stability score.
[0059] It should be noted that bandwidth priority refers to the priority set according to the maximum transmission bandwidth of each switch link (e.g., if link a has a bandwidth of 10Gbps and link b has a bandwidth of 8Gbps, then link a has a higher priority than link b). The higher the bandwidth, the higher the priority. For example, the historical link stability score refers to the score calculated based on the link's operating data over the past 30 days (this embodiment does not limit the historical time). (For example, the fewer the failure frequency and the longer the average fault-free operating time, the higher the score). Optionally, the preset link configuration rules include: bandwidth priority of each switch link, historical link stability score, and preset link switching strategy; wherein, the bandwidth priority is sorted from high to low according to the maximum transmission bandwidth of the link, and the historical link stability score is determined based on the historical failure frequency and the mean time between failures.
[0060] Understandably, the preset link switching strategy is a pre-configured backup link selection logic (such as "prioritize the link with the highest bandwidth" or "prioritize the link with the highest stability score").
[0061] Specifically, taking the transmitting switch SW1 as an example, it is configured with three links: link a (10G), link b (8G), and link c (10G). After the hardware module detects a failure in link a (the first link), the driver software module calls the preset link configuration rules; First, filter by "bandwidth priority": After link a fails, among the remaining links b (8G) and c (10G), link c has a higher bandwidth priority; Then verify using the "historical stability score": If link c has failed twice in the past 30 days with an average fault-free time of 200 hours (score = (1-2 / 30)×100+200 / 10≈93.3+20=113.3), and link b has failed five times in the past 30 days with an average fault-free time of 150 hours (score = (1-5 / 30)×100+150 / 10≈83.3+15=98.3), then link c has better stability; Ultimately, link c was determined to be the second link, and its corresponding outgoing interface 3 was determined to be the second outgoing interface, so as to ensure that the selection of the backup link meets both bandwidth requirements and high stability.
[0062] In this embodiment, by clearly defining the preset link configuration rules based on bandwidth priority and historical link stability score, it is ensured that when the driver software module selects a backup link, it can prioritize the selection of a link with higher bandwidth and more stable historical operation as the second link. This avoids the decline in link transmission performance or failure again after switching due to blindly selecting a backup link, and ensures the efficiency and stability of service packet forwarding after switching.
[0063] Based on any of the above embodiments, the forwarding table entry switching instruction includes the physical identifier of the second outgoing interface, the logical link identifier of the second link, and the table entry update execution flag.
[0064] Understandably, the physical identifier of the second outgoing interface refers to the hardware number of the second outgoing interface on the sending switch (such as the physical address 0x02 and port number Gi1 / 0 / 2 of outgoing interface 2), which is used by the hardware module to accurately locate the forwarding port. The logical link identifier of the second link is the logical number assigned to the second link (such as "Link_B_001"), which is used to distinguish different links and facilitates subsequent topology updates at the protocol layer. The table entry update execution flag is used to indicate when the hardware module performs table entry updates (such as "update immediately" or "update after 1ms delay"). Optionally, the default configuration is "update immediately" to shorten the switching latency.
[0065] As an example, the format of the forwarding table entry switching instruction called by the driver software module is as follows: {"Physical Identifier":"Gi1 / 0 / 2","Logical Link Identifier":"Link_B_001","Execution Flag":"Update Now"} After receiving the instruction, the hardware module replaces the original forwarding rule of "Outgoing Interface 1 - Link a" with "Outgoing Interface 2 - Link b" through the table entry writing unit of the internal chip. The whole process is completed in a very short time.
[0066] In this embodiment, by explicitly including the physical identifier of the second outgoing interface, the logical identifier of the second link, and the execution flag of the table update in the forwarding table entry switching instruction, the hardware module can accurately identify the target outgoing interface and link to be switched, as well as the execution timing of the table update. This avoids problems such as switching misalignment and delayed execution caused by incomplete instruction information, improves the accuracy and efficiency of hardware table entry switching, and further shortens the convergence time.
[0067] Based on any of the above embodiments, the network device further includes a protocol software module; the method further includes: The driver software module sends the fault information and the second link activation status information to the protocol software module, so that the protocol software module updates the network topology and sends the updated topology information to the driver software module. The updated topology information is used to instruct the driver software module to update the configuration information of the hardware module. The configuration information includes link priority data, backup link redundancy identifier, and interface status synchronization data.
[0068] It should be noted that this embodiment illustrates the logic of updating the protocol status and information, updating the driver software information, and then flashing other hardware information to solve the problem of network status consistency after driver priority switching.
[0069] Specifically, after the hardware module completes the table switching, the driver software module sends "fault information + second link activation status information" (such as "link a: physically disconnected; link b: active and available") to the protocol software module. The protocol software module updates the network topology based on the above information (such as marking link a as "faulty" and link b as "active"). The protocol software module sends the updated topology information (including configuration information) to the driver software module. Based on the topology information, the driver software module updates the configuration information of the hardware module to ensure that the rapid hardware switching and protocol status synchronization do not conflict and do not cause network instability.
[0070] It should be understood that the protocol software module refers to the software component responsible for network topology management, route calculation, and link state synchronization (such as a software platform running redundant protocols such as STP and VRRP). It can update the network topology based on fault information and feed back configuration instructions to the driver software module.
[0071] The second link activation status information is used to indicate the status data that the second link has switched from "inactive" to "active" (e.g., "Link b: Active and available").
[0072] Configuration information refers to the parameters that need to be synchronized to the hardware module after the protocol software module updates the topology, including but not limited to: Link priority data: The priority of each link after the update (e.g., link b's priority is changed from "low" to "high"); Backup link redundancy identifier: Marks currently available backup links (e.g., "Link c is the backup link for link b"); Interface status synchronization data: the current status of each outgoing interface (e.g., "Outgoing interface 1: Faulty and unavailable, Outgoing interface 2: Active and available").
[0073] In this embodiment, by supplementing the protocol software module and driver synchronization information - protocol update topology - driver completes hardware configuration process, on the basis of driver-prioritized fast hardware switching, the network topology and hardware configuration are kept consistent, which solves the problem of network state chaos that may be caused by directly switching hardware without skipping the protocol layer, and achieves the dual goals of fast switching and network stability. At the same time, by clarifying the specific content of the configuration information, clear guidance is provided for hardware configuration completion.
[0074] Based on any of the above embodiments, the protocol software module updates the network topology through the following steps: Based on the fault information, the first link is marked as faulty, and based on the second link activation status information, the second link is marked as available. Based on the pre-stored connection relationships of each switch port in the protocol software module, the fault status of the first link, and the availability status of the second link, an updated network topology diagram is generated. The updated network topology diagram is synchronized to the driver software module.
[0075] It should be noted that the dual-link architecture of SW1 and SW2 is used as an example: Status marking refers to the process by which the protocol software module, after receiving fault information, extracts the identifier of the first link (such as "Link_A_001") and marks it as faulty and unavailable; and extracts the identifier of the second link (such as "Link_B_001") and marks it as active and available. Specifically, the pre-stored connection relationship table of each switch port is invoked (e.g., "SW1's Gi1 / 0 / 1 connects to SW2's Gi1 / 0 / 1, SW1's Gi1 / 0 / 2 connects to SW2's Gi1 / 0 / 2"). Combined with the aforementioned status flags, the association relationship of "link a - port Gi1 / 0 / 1" in the original topology is corrected, generating an updated topology diagram (e.g., "SW1→Gi1 / 0 / 2→link b→SW2's Gi1 / 0 / 2"). The updated topology diagram is then synchronized to the driver software module in JSON format to ensure consistency between the driver's and protocol's topology understanding.
[0076] In this embodiment, by refining the three-step process of "marking status - generating topology map - synchronizing drive" for updating network topology by the protocol software module, and combining it with the pre-stored switch port connection relationships, it is ensured that the protocol layer can accurately and efficiently complete the network topology update, avoiding topology errors or update delays caused by ambiguity in the topology update logic, providing accurate topology basis for the driver software module to complete the hardware configuration, and further ensuring the consistency of network status.
[0077] Based on any of the above embodiments, the driver software module updates the configuration information of the hardware module through the following steps: The updated link priority data, backup link redundancy identifier, and interface status are synchronized to the hardware module after the network topology update.
[0078] It should be understood that synchronizing the updated link priority data, backup link redundancy identifier, and interface status to the hardware module is to override the historical topology association configuration in the hardware module.
[0079] As an example, the driver software module receives configuration information (such as "Link b priority: high; backup link: link c; outgoing interface 2: active") sent by the protocol software module. The driver software module calls the SDK to write the link priority data, backup link redundancy flag, and interface status synchronization data into the configuration register of the hardware module. The hardware module overwrites the original historical topology association configuration with the new configuration (such as the original "Link a priority: high" being replaced with "Link b priority: high") to ensure that the hardware configuration is completely synchronized with the protocol topology and avoid inconsistencies in status.
[0080] In this embodiment, by specifying the details of the hardware configuration update by the driver software module (i.e., link priority, backup link redundancy identifier, and interface status), it is ensured that the hardware module can fully synchronize the updated topology information of the protocol layer, cover historical redundant configurations, avoid forwarding anomalies caused by conflicts between old configurations and new topologies, further solidify the foundation for network state consistency, and ensure long-term stable operation of the link after the switchover.
[0081] Based on any of the above embodiments, the method further includes: If the first link status data exceeds a preset fault proximity threshold and it is determined based on the first link status data that the first link is not completely faulty, then the driver software module is controlled to call the software development kit to send a hardware entry configuration instruction to the hardware module; the hardware entry configuration instruction is used to instruct the hardware module to retain hardware entries for both the first output interface and the second output interface.
[0082] It should be noted that the preset fault proximity threshold refers to the warning threshold that is lower than the fault threshold (e.g., if the fault threshold is an error rate of 1% and a latency of 100ms, then the fault proximity threshold can be set to an error rate of 0.8% and a latency of 80ms). The preset fault proximity threshold is used to detect the trend of link deterioration in advance.
[0083] Hardware entry configuration instructions refer to instructions sent by the driver software module to the hardware module to retain the main and backup outgoing interface entries (such as "retain the forwarding table entries of outgoing interface 1 and outgoing interface 2, and give priority to outgoing interface 1").
[0084] As an example, the hardware module detects that the error rate of link a reaches 0.8% (exceeding the fault proximity threshold of 0.8% but not reaching the fault threshold of 1%), and determines that link a is close to failure but not completely failed. The hardware module sends this status data to the driver software module. The driver software module calls the SDK to send a hardware entry configuration instruction to the hardware module. After receiving the instruction, the hardware module retains the hardware entries for both outgoing interface 1 (link a) and outgoing interface 2 (link b) and configures "prioritize forwarding through outgoing interface 1". When the error rate of link a reaches 1% (complete failure) in the future, the hardware module can directly switch to forwarding through outgoing interface 2 without regenerating the entries, thereby further shortening the disconnection time.
[0085] Optionally, if the first link status data exceeds a preset fault proximity threshold and it is determined based on the first link status data that the first link is not completely faulty, then the driver software module is controlled to call the software development kit to send a hardware entry configuration instruction to the hardware module. The hardware entry configuration instruction is used to instruct the hardware module to retain hardware entries for both the first and second outgoing interfaces and configure the forwarding priority of the hardware entries—prioritizing forwarding packets through the first outgoing interface. When the hardware module detects a complete fault in the first link (the physical layer on / off signal is in a disconnected state or the status data exceeds a preset fault threshold), the hardware module immediately switches to forwarding packets through the second outgoing interface based on the retained second outgoing interface entry.
[0086] In this embodiment, a fault prediction mechanism is used to retain primary and backup outgoing interface entries when a new link is about to fail. This allows for the configuration of backup entries in advance when the link is not completely faulty, so that the switchover can be completed immediately without regenerating entries when the link is completely faulty, further shortening the disconnection time.
[0087] Based on any of the above embodiments, the fault information includes the identifier of the first link, the fault type, and the timestamp of the fault occurrence.
[0088] It should be noted that the identifier of the first link refers to the number used to uniquely distinguish the first link (such as "Link_A_001", "SW1-SW2_Link1", etc.).
[0089] Fault type is used to describe the specific cause of link failure (such as physical disconnection, high error rate, timeout, etc.).
[0090] The timestamp of the fault occurrence refers to the specific time when the hardware module determined the link fault (e.g., "2024-05-2014:30:00.123").
[0091] Fault information includes identifier, type, and timestamp, which has the following advantages: The protocol software module accurately locates the faulty link by identifying the first link, thus avoiding topology update misalignment. Select a targeted recovery strategy based on the type of fault (e.g., if there is a physical disconnection, notify the operations and maintenance personnel to investigate; if the error rate is high, try restarting the link). Recording the sequence of fault occurrences using timestamps facilitates subsequent network fault tracing and analysis, providing support for protocol layer processing and operation and maintenance management.
[0092] In the specific implementation, there are two links between switches SW1 and SW2. Normally, after the switches are configured with the protocol, they discover the network topology through the protocol, select the primary and backup links according to certain rules, form forwarding information, and then send it to the driver platform. The driver platform then sends hardware entries, and traffic is forwarded according to these hardware entries. Figure 2 There is one primary link (link a) and one backup link (link b). Under normal circumstances, link a is active and forwards traffic normally; link b is inactive, receives no traffic, and its port is blocked. (Follow the procedure.) Once hardware entries are created, they guide traffic forwarding.
[0093] Reference Figure 3 When link a fails, the driver first detects the fault and reports it to the protocol platform for an update. Based on the information reported by the driver, the platform updates the network topology, reselects interfaces, and activates the backup link b. The updated information is then sent to the driver platform following the original process, and the driver sends instructions to the hardware to guide the forwarding of network packets. After link a fails, the network devices... Convergence is achieved after three steps.
[0094] Reference Figure 4 Since the link failure is detected first by the driver, it can directly send a command to the hardware to forcibly update the hardware table entry to output 2. This is much faster than reporting the link failure first, updating the protocol, sending the driver, and then updating the hardware table entry. This shortens the disconnection time and accelerates the convergence of the entire link. Normal operation then resumes. Figure 4 The process Update the protocol status and information, update the driver software information, and then flash other hardware information. Normal output interfaces can be directly overwritten without any impact.
[0095] It should be understood that the switch link switching method described in the above embodiments and this embodiment, which directly switches hardware entries by bypassing the protocol through the driver, will not lead to network instability. The method pre-flashes the hardware, changes the forwarding table output interface, reduces packet loss, and ensures that faults are still reported. All layers of protocols are processed normally, and protocol state switching is performed. After processing, flashing the hardware again allows for checking the hardware status. If the read data matches the flashed data, repeated hardware flashing is unnecessary.
[0096] In addition, the method can predict faults. Specifically, when the link a index is detected to be close to the fault threshold rather than a complete fault, a pre-switching is triggered in advance. The soft activation status of the backup egress entry is first issued by the driver (that is, the hardware entry retains both the primary and backup egress, with the primary egress being used first, and switching to the backup egress only when the primary egress completely fails), which further shortens the disconnection time.
[0097] In this embodiment, by clearly defining the fault information, including link identifier, fault type, and timestamp, complete information is provided for the protocol software module to accurately locate the faulty link and select a targeted recovery strategy. At the same time, it provides reliable data support for subsequent network fault tracing and analysis, making it easier for maintenance personnel to investigate the cause of the fault.
[0098] Based on the methods described in any of the above embodiments, this application also provides, as follows: Figure 5 The diagram shows the structure of an electronic device. Figure 5 At the hardware level, the electronic device includes a processor, an internal bus, a network interface, memory, and non-volatile memory, and may also include other hardware required for business operations. The processor reads the corresponding computer program from the non-volatile memory into memory and then runs it to implement the methods described in any of the above embodiments.
[0099] Based on the methods described in any of the above embodiments, this application also provides a computer storage medium storing a computer program, which, when executed by a processor, can be used to perform the methods described in any of the above embodiments.
[0100] Based on the methods described in any of the above embodiments, this application also provides a computer program product, which includes one or more computer programs or instructions. The computer program or instructions may be stored in a computer-readable storage medium or transferred from one computer-readable storage medium to another. When executed by a processor, the computer program implements the methods described in any of the above embodiments.
[0101] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0102] In addition, the functional modules in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0103] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0104] The above description is merely an embodiment of this application and is not intended to limit the scope of protection of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of protection of this application. It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.
[0105] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
[0106] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A method for switching links on a switch, characterized in that, The method is applied to a multi-link network device, which includes a hardware module, a driver software module, a software development kit, and multiple switch links. Each switch link is equipped with a transmitting switch and a receiving switch, and each transmitting switch is configured with an outgoing interface corresponding to each switch link. The method includes: During the process of the network device forwarding packets using the first link among multiple switch links, if it is determined that the first link has failed based on the first link status data monitored by the hardware module, the hardware module is controlled to send the fault information to the driver software module. The control software module identifies the first outgoing interface associated with the first link on the sending end switch based on the fault information. The first outgoing interface is the packet forwarding exit of the first link. The control software module determines a second outgoing interface to replace the first outgoing interface from multiple outgoing interfaces of the transmitting switch based on preset link configuration rules. The second outgoing interface is associated with a second link among multiple switch links. The driver software module calls the software development kit to send a forwarding table entry switching instruction to the hardware module. The forwarding table entry switching instruction is used to instruct the hardware module to update the hardware table entry for packet forwarding from the first outgoing interface and the first link to the second outgoing interface and the second link, and to forward packets using the second link and the second outgoing interface.
2. The method according to claim 1, characterized in that, The first link status data includes the physical layer connectivity signal of the first link, packet forwarding error rate data, or link latency data; if the first link is determined to have failed based on the first link status data monitored by the hardware module, then controlling the hardware module to send the fault information to the driver software module includes: If the hardware module detects that the physical layer connectivity signal of the first link is disconnected, the packet forwarding error rate data exceeds the preset error rate threshold, or the link delay data exceeds the delay threshold, it determines that the first link has failed and controls the hardware module to send the fault information to the driver software module.
3. The method according to claim 1, characterized in that, The preset link configuration rules include: bandwidth priority of each switch link and historical link stability score.
4. The method according to claim 1, characterized in that, The forwarding table entry switching instruction includes the physical identifier of the second outgoing interface, the logical link identifier of the second link, and the entry update execution flag.
5. The method according to claim 1, characterized in that, The network device further includes a protocol software module; the method further includes: The driver software module sends the fault information and the second link activation status information to the protocol software module, so that the protocol software module updates the network topology and sends the updated topology information to the driver software module. The updated topology information is used to instruct the driver software module to update the configuration information of the hardware module. The configuration information includes link priority data, backup link redundancy identifier, and interface status synchronization data.
6. The method according to claim 5, characterized in that, The protocol software module updates the network topology through the following steps: Based on the fault information, the first link is marked as faulty, and based on the second link activation status information, the second link is marked as available. Based on the pre-stored connection relationships of each switch port in the protocol software module, the fault status of the first link, and the availability status of the second link, an updated network topology diagram is generated. The updated network topology diagram is synchronized to the driver software module.
7. The method according to claim 5, characterized in that, The driver software module updates the configuration information of the hardware module through the following steps: The updated link priority data, backup link redundancy identifier, and interface status are synchronized to the hardware module after the network topology update.
8. The method according to claim 1, characterized in that, The method further includes: If the first link status data exceeds a preset fault proximity threshold and it is determined based on the first link status data that the first link is not completely faulty, then the driver software module is controlled to call the software development kit to send a hardware entry configuration instruction to the hardware module; the hardware entry configuration instruction is used to instruct the hardware module to retain hardware entries for both the first output interface and the second output interface.
9. The method according to any one of claims 1-8, characterized in that, The fault information includes the identifier of the first link, the fault type, and the timestamp of the fault occurrence.
10. An electronic device, characterized in that, The electronic device includes: processor; Memory used to store processor-executable instructions; Wherein, when the processor invokes the executable instructions, it implements the method according to any one of claims 1-9.
11. A computer-readable storage medium, characterized in that, It stores computer instructions that, when executed by a processor, implement the steps of any of the methods described in claims 1-9.
12. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the method described in any one of claims 1-9.
Citation Information
Patent Citations
Link switching method, device, SDN switch, controller and storage medium
CN107547249A
Link switching method, device and equipment and machine readable storage medium
CN112104478A
Virtual link aggregation of network traffic in an aggregation switch
US20110228767A1