A switch link switching method, electronic equipment, storage medium and program product
By using a method that involves real-time monitoring of hardware modules and direct updating of hardware forwarding table entries via driver software modules, the problems of slow network convergence and packet loss during switch link switching are solved, achieving fast switching and a stable network state.
Patent Information
- Application Number
- CN202511430510.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-09
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2045-10-09
AI Technical Summary
Existing switch link switching methods suffer from slow network convergence and high packet loss, especially in the event of link failure, which prevents rapid switching and leads to network instability.
By monitoring the link status in real time through hardware modules, the software modules directly call the software development kit to update the hardware forwarding table entries, skipping the redundant process of prioritizing traditional protocol layer processing, and realizing rapid switching from faulty links to backup links. Combined with fault prediction mechanisms and clear link configuration rules, the accuracy and efficiency of switching are ensured.
It enables rapid convergence when switch link failures occur, reduces packet loss, ensures network stability and service continuity, and improves the accuracy and timeliness of link failure identification.
Smart Images

Figure CN120896840B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of network communication, in particular to a switch link switching method, an electronic device, a storage medium and a program product. BACKGROUND
[0002] In the current network communication system, the switch as an important forwarding device realizes the forwarding of network packets through the cooperative work of hardware modules and software modules. In order to meet the high reliability requirement, multi-link (such as dual-link, multi-link redundancy) or dual-machine redundancy architecture is widely used - that is, multiple physical links are deployed between switches (such as link a and link b between switches SW1 and SW2), and the network fault tolerance capability is enhanced through the "primary and backup link" mechanism: in the normal state, the primary link (such as link a) is in an active state and undertakes all business packet forwarding, and the backup link (such as link b) is in an inactive state (port blocking) and has no service traffic transmission; when the primary link fails (such as physical disconnection, high error rate of forwarding), it needs to be switched to the backup link for forwarding to restore business communication. However, the switch link switching method in the related art has problems such as slow network convergence and many packet loss. SUMMARY
[0003] The purpose of the embodiments of the present application is to provide a switch link switching method, an electronic device, a storage medium and a program product, which can realize fast link switching and prevent packet loss.
[0004] The first aspect of the embodiments of the present application provides a switch link switching method, which is applied to a network device with multiple links, the network device comprising a hardware module, a driver software module, a software development kit, and multiple switch links, each of the switch links being deployed with a sending switch and a receiving switch, and each of the sending switches being configured with an out-interface corresponding to each switch link; the method comprises:
[0005] In the process that the network device forwards packets by using a first link in the multiple switch links, if it is determined based on first link state data monitored by the hardware module that the first link fails, the hardware module is controlled to send failure information to the driver software module;
[0006] The driver software module is controlled to identify a first out-interface associated with the first link on the sending switch based on the failure information, the first out-interface being a packet forwarding outlet of the first link;
[0007] The driving software module is controlled to determine a second outgoing interface for replacing the first outgoing interface from a plurality of outgoing interfaces of the sending-end switch based on a preset link configuration rule, the second outgoing interface being associated with a second link in the plurality of switch links;
[0008] The driving software module is controlled to call the software development kit to send a forwarding table item switching instruction to the hardware module, the forwarding table item switching instruction being used to instruct the hardware module to update a hardware table item for forwarding a packet 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 the packet.
[0009] In the implementation process, after the hardware detects a fault, the driving software module directly calls the software development kit to update the hardware forwarding table, skips a redundant process of a traditional protocol layer and preferentially processes, realizes quick switching of a fault link to a backup link, solves problems of slow network convergence and many packet losses, and guarantees continuity of basic forwarding services of a multi-link switch.
[0010] Further, the first link state data includes a physical layer on-off signal of the first link, packet forwarding error rate data or link delay data; and if it is determined that the first link has a fault based on the first link state data monitored by the hardware module, the hardware module is controlled to send fault information to the driving software module, including:
[0011] If the hardware module monitors that the physical layer on-off signal of the first link is in an off state, the packet forwarding error rate data exceeds a preset error rate threshold, or the link delay data exceeds a delay threshold, it is determined that the first link has a fault, and the hardware module is controlled to send the fault information to the driving software module.
[0012] In the implementation process, by specifying specific types (a physical layer on-off signal, packet forwarding error rate and link delay) of the first link state data and a rule of determining a fault according to any index triggering threshold, misjudgment or omission caused by fuzzy fault determination standards is avoided, and accuracy and timeliness of link fault identification are improved.
[0013] Further, the preset link configuration rule includes a bandwidth priority of each switch link and a historical link stability score.
[0014] In the implementation process, the preset link configuration rule is used to ensure that the drive software module can select a link with higher bandwidth and better historical stability as the second link when selecting a backup link, so as to avoid the decline or failure of link transmission after switching due to blind selection of a backup link, and to ensure the efficiency and stability of the service message forwarding after switching.
[0015] Further, the forwarding table item switching instruction includes a physical identifier of the second out interface, a logical link identifier of the second link, and a table item update execution marker.
[0016] In the implementation process, the forwarding table item switching instruction includes a physical identifier of the second out interface, a logical link identifier of the second link, and a table item update execution marker, which ensures that the hardware module can accurately identify the target out interface and link to be switched and the execution time of the table item update, avoids switching misplacement and delayed execution caused by incomplete instruction information, improves the accuracy and efficiency of hardware table item switching, and further shortens the convergence time.
[0017] Further, the network device further includes a protocol software module; and the method further includes:
[0018] The drive software module sends the fault information and the second link activation state information to the protocol software module, so that the protocol software module updates the network topology and sends the updated topology information to the drive software module, and the updated topology information is used to instruct the drive software module to update the configuration information of the hardware module, and the configuration information includes link priority data, backup link redundancy identifier, and interface state synchronization data.
[0019] In the implementation process, the protocol software module and the drive synchronization information-protocol update topology-drive complete hardware configuration process are supplemented, which ensures that the network topology and the hardware configuration are consistent on the basis of the drive priority implementation of the hardware fast switching, solves the network state confusion problem caused by directly switching the hardware without passing through the protocol layer, realizes the dual goals of fast switching and network stability, and clearly indicates the specific content of the configuration information to provide clear guidance for hardware configuration completion.
[0020] Further, the protocol software module updates the network topology by the following steps:
[0021] The first link is marked as a fault state based on the fault information, and the second link is marked as an available state based on the second link activation state information.
[0022] generate an updated network topology graph based on the pre-stored connection relationship of each switch port in the protocol software module, the failure state of the first link, and the available state of the second link;
[0023] synchronize the updated network topology graph to the driver software module.
[0024] In the above implementation process, by refining the three-step process of "marking state-generating topology graph-synchronizing driver" of the protocol software module updating the network topology, combined with the pre-stored connection relationship of the switch port, it is ensured that the protocol layer can accurately and efficiently complete the network topology update, avoid topology errors or update delay caused by ambiguous topology update logic, provide accurate topology basis for the driver software module to complete the hardware configuration, and further guarantee the consistency of the network state.
[0025] Further, the driver software module updates the configuration information of the hardware module by the following steps:
[0026] synchronize the link priority data, backup link redundancy identifier, and interface state of the updated network topology to the hardware module.
[0027] In the above implementation process, by specifying the specific content of the driver software module updating the hardware configuration (i.e. link priority, backup link redundancy identifier, and interface state), it is ensured that the hardware module can completely synchronize the updated topology information of the protocol layer, cover the historical redundant configuration, avoid forwarding abnormalities caused by conflicts between old configuration and new topology, further consolidate the foundation of network state consistency, and guarantee long-term stable operation of the link after switching.
[0028] Further, the method further comprises:
[0029] If the first link state data exceeds the pre-set failure proximity threshold and it is determined based on the first link state data that the first link is not completely failed, the driver software module is controlled to call the software development kit and send a hardware table item configuration instruction to the hardware module; the hardware table item configuration instruction is used to instruct the hardware module to simultaneously retain hardware table items of the first out-interface and the second out-interface.
[0030] In the above implementation process, by adding the failure prediction mechanism of retaining the primary and backup out-interface table items when the link is in a near-failure state, the backup table item configuration is completed in advance when the link is not completely failed, so that the link can be immediately switched without generating new table items when the link is completely failed, further shortening the outage time.
[0031] Further, the failure information includes the identifier, failure type, and timestamp of the first link.
[0032] In the implementation process, by explicitly including link identifier, fault type and timestamp in the fault information, complete information is provided for the protocol software module to accurately locate the fault link and select a targeted recovery strategy, and reliable data support is provided for subsequent network fault tracing and analysis, thereby facilitating the troubleshooting of the fault reason by the operation and maintenance personnel.
[0033] The second aspect of the embodiment of the application provides an electronic device, the electronic device comprising:
[0034] a processor;
[0035] a memory for storing processor-executable instructions;
[0036] The processor calls the executable instructions to implement the method of any one of the first aspect.
[0037] The third aspect of the embodiment of the application provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are executed by a processor to implement the steps of the method of any one of the first aspect.
[0038] The fourth aspect of the embodiment of the application provides a computer program product, which comprises a computer program, and the computer program is executed by a processor to implement the method of any one of the first aspect. BRIEF DESCRIPTION OF DRAWINGS
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the application, the following will briefly introduce the drawings needed to be used in the embodiments of the application. It should be understood that the following drawings only show some embodiments of the application, and therefore should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can also be obtained without creative labor on the basis of these drawings.
[0040] Figure 1 A flowchart of a switch link switching method provided by the embodiment of the application;
[0041] Figure 2 A switch primary and backup link normal forwarding and hardware entry generation diagram provided by the embodiment of the application;
[0042] Figure 3 A switch primary link fault triggering hardware entry switching diagram provided by the embodiment of the application;
[0043] Figure 4 A switch link switching protocol synchronization and hardware configuration completion diagram provided by the embodiment of the application;
[0044] Figure 5 A structural block diagram of an electronic device provided by the embodiment of the application. DETAILED DESCRIPTION
[0045] The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
[0046] It should be noted that similar reference numerals and letters refer to similar items in the following drawings, and therefore, once an item is defined in one drawing, it need not be further defined and explained in subsequent drawings. Meanwhile, in the description of the present application, the terms "first", "second", and the like are only used to distinguish description, and cannot be understood as indicating or implying relative importance.
[0047] Current network switches realize network message forwarding through cooperation of software and hardware. When the reliability requirement is relatively high, dual-link or dual-device redundancy needs to be used to enhance the reliability of the network. When a link fails or a device fails, traffic switching can be realized through master-slave switching.
[0048] However, the related switch link switching technology has the following defects, resulting in slow convergence and many packet losses when the multi-link switch fails to switch:
[0049] (1) Long convergence time: the related technology needs to first report the fault information to the protocol software module by the hardware module, and then the protocol software module updates the network topology and recalculates the forwarding path, and then the new path is issued to the driver software module, and finally the hardware module is controlled by the driver software module to update the forwarding rule. The logic of "protocol layer priority processing" in the whole process causes the hardware module to be unable to update the table item in time, and the flow interruption time usually exceeds 100 ms, which easily causes a large number of business message losses;
[0050] (2) Lack of fault prediction mechanism: the related technology only triggers switching after the link is completely faulty, and does not consider the scenario that the link index is close to the fault threshold but not completely failed, and cannot further shorten the switching delay.
[0051] In view of the above defects, the embodiments of the present application propose a logic of hardware priority monitoring, driver priority switching, and protocol post-synchronization, combined with a fault prediction mechanism, to realize fast convergence and network stability. When the switch link fails or is close to failure, fast switching and optimization of the message forwarding path are completed to shorten the network convergence time, prevent business message packet loss, and ensure network state consistency.
[0052] Based on this, the embodiments of the present application provide a switch link switching method, which refers to Figure 1 , Figure 1 A flowchart of a switch link switching method provided by the embodiments of the present application is shown in the figure.
[0053] In this embodiment, the method is applied to a multi-link network device, which includes a hardware module, a driver software module, a software development kit, and a plurality of switch links, each of which is deployed with a sending switch and a receiving switch, and each of the sending switches is configured with an out interface corresponding to each switch link. The method comprises:
[0054] Step S10: In the process of forwarding the packet by the network device using the first link in the plurality of switch links, if it is determined that the first link fails based on the first link state data monitored by the hardware module, the hardware module is controlled to send the failure information to the driver software module.
[0055] It should be noted that the multi-link network device refers to a communication device deploying at least two switch links, including but not limited to enterprise-level switches, data center switches, etc., and its typical architecture is a "sending switch-receiving switch" dual-device dual-link (for example, SW1 is a sending switch, SW2 is a receiving switch, and links a and b are deployed between them).
[0056] The sending switch is the output end of the packet and is configured with an out interface corresponding to each link; the receiving switch is the input end of the packet, and the two cooperate to realize link redundancy.
[0057] The hardware module refers to a physical component (such as a switch chip or a port controller) in the network device responsible for physical layer link state monitoring, packet forwarding execution, and hardware table storage. It can collect data such as link continuity and forwarding error rate in real time and perform hardware table updates.
[0058] The driver software module refers to middleware between the hardware module and the protocol software module, which is responsible for receiving failure information from the hardware module, analyzing protocol layer instructions, and calling the software development kit (SDK) to control the table configuration of the hardware module.
[0059] The software development kit (SDK) refers to a set of programming interfaces provided by the hardware manufacturer. The driver software module calls the interfaces (such as table writing interfaces and state reading interfaces) of the SDK to achieve configuration and control of the hardware module.
[0060] The switch link refers to a physical communication link connecting the sending switch and the receiving switch, and each link corresponds to an "out interface" of the sending switch (for example, link a corresponds to the out interface 1 of SW1, and link b corresponds to the out interface 2 of SW1).
[0061] The out interface refers to a physical port on the sending switch used for packet forwarding, which corresponds to the switch link one by one and is the identifier of the "packet outlet" in the hardware table.
[0062] The fault information refers to information generated by the hardware module, containing link fault identification, fault type, etc., and is used to drive the software module to identify the fault link. Exemplarily, the fault information content includes "link a (first link) physical disconnection.
[0063] Specifically, when the network device forwards a packet through the first link (such as link a), at this time, the first out interface (1 port of SW1) is activated, the second out interface (2 port of SW1) of the second link (such as backup link b) is blocked, and the hardware table item of the hardware module is configured as "outlet 1→link a", and the packet is forwarded according to this table item. The hardware module collects state data (such as physical layer on-off signal, forwarding error rate, etc.) of the first link in real time; if the hardware module determines that the first link has a fault (such as the physical layer on-off signal is disconnected), the fault information (containing link identification, fault type) is sent to the driving software module, and the rapid perception of the fault is realized.
[0064] It should be understood that controlling the hardware module does not refer to an additional external control body, and the hardware module does not need external control. The hardware module actively monitors and actively reports, and the "control" is essentially an embodiment of the hardware module performing autonomously according to the preset logic.
[0065] Step S20: controlling the driving software module to identify a first out interface associated with the first link on the sending end switch based on the fault information, the first out interface being a packet forwarding outlet of the first link;
[0066] It should be noted that the first out interface is the out interface corresponding to the first link (i.e., the main link) (such as link a corresponding to 1 port of SW1); the second out interface is the out interface corresponding to the second link (i.e., the backup link) (such as link b corresponding to 2 port of SW1), and the two are in a master-slave replacement relationship.
[0067] Specifically, after the driving software module receives the fault information, it identifies the first out interface (out interface 1) associated with the first link on the sending end switch through a pre-stored link-out interface mapping table (such as the mapping table indicating "link a→out interface 1"), and determines the packet forwarding outlet corresponding to the fault link.
[0068] Step S30: controlling the driving software module to determine a second out interface for replacing the first out interface from a plurality of out interfaces of the sending end switch based on a preset link configuration rule, the second out interface being associated with a second link in the plurality of switch links;
[0069] It should be noted that the preset link configuration rule refers to a standby out interface selection logic pre-configured in the drive software module, the core of which is to determine the standby out interface from multiple out interfaces when the main link fails. Optionally, the main link corresponds to the main out interface, and the standby link corresponds to the standby out interface (i.e. fixed main-standby mapping). Exemplarily, the sw1 and sw2 traffic go through the link a, i.e. the out interface is 1, and the standby interface is 2, i.e. the preset link configuration rule is that the standby link of the link a (the first link) is the link b (the second link), and the standby interface of the out interface 1 is the out interface 2. This rule does not need complex calculation, and is directly determined based on the pre-configured main-standby relationship to realize fast link switching, shorten the convergence time, and avoid the time delay of re-computing the path by the traditional protocol layer.
[0070] Specifically, the drive software module directly locates the standby out interface (2) of the first out interface (1) from multiple out interfaces (such as 1 and 2 of SW1) of the sending end switch based on the above rule, i.e. the second out interface; the second out interface is associated with the second link (link b). This process embodies the "main-to-standby" logic, i.e. after the link a fails, the 2 directly activated by the link b does not need additional topology calculation.
[0071] Step S40: control the drive software module to call the software development kit to send a forwarding table item switching instruction to the hardware module, the forwarding table item switching instruction being used to instruct the hardware module to update the hardware table item for message forwarding from the first out interface and the first link to the second out interface and the second link, and use the second link and the second out interface to forward the message.
[0072] It should be noted that the forwarding table item switching instruction refers to an instruction sent by the drive software module to the hardware module through the SDK, which is used to update the forwarding out of the hardware table item, i.e. from the first out interface-first link to the second out interface-second link.
[0073] The hardware table item refers to a forwarding rule table stored in the hardware module, which records the out interface from which the message needs to be forwarded and the link through which the message needs to be forwarded, and is a direct basis for the hardware module to guide message forwarding.
[0074] It should be understood that since the drive software module first perceives the link failure, the hardware module can be directly sent by the drive software module first, and the hardware table item is forcibly brushed to the out 2, which is much faster than reporting the link failure first, updating the protocol, then sending the drive software module, and then updating the hardware table item. The drive software module does not pass through the protocol software module, directly calls the software development kit, skips the traditional protocol priority redundancy process, and accelerates the convergence.
[0075] The role of the forwarding table item switching instruction: the instruction includes the information of the target out interface (such as the 2nd interface) and the target link (such as the link b), and essentially drives the calling of the SDK to write the specific implementation form of the hardware. After the hardware module receives the instruction, it will immediately update the hardware table item (which is used to guide the packet forwarding) stored by itself - from the original "first out interface 1→first link a" to "second out interface 2→second link b".
[0076] After the hardware table item is updated, the hardware module directly forwards the packet according to the new table item - that is, it forwards the packet to the receiving end switch SW2 through the second out interface (2nd interface) and the second link (link b), so as to realize the rapid recovery of the service flow. Compared with the traditional scheme which needs to wait for the protocol layer processing, the present embodiment directly operates the hardware through the drive, shortens the flow interruption time to the minimum, and prevents packet loss.
[0077] In the present embodiment, after the hardware detects the fault, the drive software module directly calls the software development kit to update the hardware forwarding table logic, skips the redundant process of the traditional protocol layer priority processing, realizes the rapid switching of the fault link to the standby link, solves the problems of slow network convergence and many packet losses, and guarantees the continuity of the basic forwarding service of the multi-link switch.
[0078] On the basis of any of the above embodiments, the first link state data includes the physical layer on-off signal of the first link, the packet forwarding error rate data, or the link delay data; if it is determined based on the first link state data monitored by the hardware module that the first link has a fault, the hardware module is controlled to send the fault information to the drive software module, including:
[0079] If the hardware module monitors that the physical layer on-off signal of the first link is in an off state, the packet forwarding error rate data exceeds a preset error rate threshold, or the link delay data exceeds a delay threshold, it is determined that the first link has a fault, and the hardware module is controlled to send the fault information to the drive software module.
[0080] It should be noted that the first link state data is a parameter obtained by the hardware module monitoring the first link, including but not limited to the following three types:
[0081] Physical layer on-off signal: an electrical signal (such as "high level" indicating connection and "low level" indicating disconnection) indicating whether the link physical layer is normally connected;
[0082] Packet forwarding error rate data: the proportion of error packets (such as CRC error and frame alignment error) in the packets forwarded by the first link in a unit of time;
[0083] Link delay data: the average time for a packet to be transmitted from the sending end switch to the receiving end switch through the first link.
[0084] It can be understood that the preset error rate threshold and the delay threshold are failure determination thresholds pre-configured according to service requirements. Optionally, the error rate threshold is 1%, and the delay threshold is 100 ms.
[0085] Specifically, the hardware module determines the first link failure through any of the following logical judgments:
[0086] If the physical layer on-off signal is in an off state (for example, the link a is unplugged by accident), the failure is directly determined;
[0087] If the physical layer on-off signal is normal, but the packet forwarding error rate exceeds the preset error rate threshold (for example, the error rate reaches 2% within 1 minute), the failure is determined;
[0088] If the link delay exceeds the delay threshold (for example, the average delay reaches 150 ms), the failure is determined;
[0089] When any of the above conditions is met, the hardware module immediately sends the failure information to the driving software module.
[0090] In the embodiment, by specifying the specific types of the first link state data (the physical layer on-off signal, the packet forwarding error rate, and the link delay) and the rule of determining the failure according to any index triggering threshold, the accuracy and timeliness of link failure identification are improved by avoiding misjudgment or omission caused by ambiguous failure determination standards.
[0091] On the basis of any of the above embodiments, the preset link configuration rule includes: based on the bandwidth priority of each switch link and the historical link stability score.
[0092] It should be noted that the bandwidth priority refers to the priority set according to the maximum transmission bandwidth of each switch link (for example, the bandwidth of link a is 10 Gbps, and the bandwidth of link b is 8 Gbps, so the priority of link a is higher than that of link b), and the higher the bandwidth, the higher the priority;
[0093] For example, the historical link stability score refers to a score calculated based on the running data of the link in the past 30 days (the implementation example does not limit the historical time), (for example, the fewer the failure frequency, the longer the average failure-free running time, and the higher the score);
[0094] Optionally, the preset link configuration rule includes: based on the bandwidth priority of each switch link, the historical link stability score, and a preset link switching strategy; wherein the bandwidth priority is sorted in descending order 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 average failure-free running time.
[0095] It can be understood that the preset link switching strategy is a preconfigured backup link selection logic (such as "preferentially selecting a link with the highest bandwidth" or "preferentially selecting a link with the highest stability score").
[0096] Specifically, taking the sending end switch SW1 as an example, the sending end switch SW1 is configured with three links: link a (10G), link b (8G), and link c (10G).
[0097] After the hardware module detects that the link a (the first link) fails, the driving software module calls the preset link configuration rule;
[0098] First, the "bandwidth priority" is filtered: among the remaining link b (8G) and link c (10G) after the link a fails, the link c has a higher bandwidth priority;
[0099] Then, the "historical stability score" is verified: if the link c has 2 failures in the last 30 days and an average failure-free time of 200 hours (score = (1-2 / 30) x 100 + 200 / 10 ≈ 93.3 + 20 = 113.3), and the link b has 5 failures in the last 30 days and an average failure-free time of 150 hours (score = (1-5 / 30) x 100 + 150 / 10 ≈ 83.3 + 15 = 98.3), then the link c has a higher stability;
[0100] Finally, the link c is determined as the second link, and the corresponding out interface 3 is determined as the second out interface, so as to ensure that the selection of the backup link meets the bandwidth requirement and has high stability.
[0101] In this embodiment, by explicitly presetting the link configuration rule based on the bandwidth priority and the historical link stability score, it is ensured that the driving software module can preferentially select a link with higher bandwidth and higher historical operation stability as the second link when selecting the backup link, so as to avoid the transmission performance of the link after switching from being reduced or failing again due to blind selection of the backup link, and to ensure the efficiency and stability of the business message forwarding after switching.
[0102] On the basis of any of the above embodiments, the forwarding table item switching instruction comprises a physical identifier of the second out interface, a logical link identifier of the second link, and a table item update execution marker.
[0103] It can be understood that the physical identifier of the second out interface refers to the hardware number (such as the physical address 0x02 and the port number Gi1 / 0 / 2 of the out interface 2) of the second out interface on the sending end switch, which is used for accurate positioning of the forwarding port by the hardware module.
[0104] The logical link identifier of the second link is a logical number (such as "Link_B_001") assigned to the second link, which is used for distinguishing different links and facilitating subsequent protocol layer topology update.
[0105] The entry update execution mark is used to indicate the timing of the hardware module to perform the entry update (such as "immediate update", "delayed 1 ms update"), and is optionally configured as "immediate update" by default to shorten the switching delay.
[0106] As an example, the forwarding entry switching instruction generated by the SDK is called by the driving software module, and has the following format:
[0107] {“physical identification”:“Gi1 / 0 / 2”,“logical link identification”:“Link_B_001”,“execution mark”:“immediate update”}
[0108] After receiving the instruction, the hardware module replaces the original forwarding rule of "out interface 1-link a" with "out interface 2-link b" through the entry writing unit of the internal chip, and the whole process is completed in a very short time.
[0109] In the embodiment, by explicitly including the second out interface physical identification, the second link logical link identification, and the entry update execution mark in the forwarding entry switching instruction, the hardware module can accurately identify the target out interface and link to be switched and the execution timing of the entry update, avoid switching misplacement and delayed execution caused by incomplete instruction information, improve the accuracy and efficiency of the hardware entry switching, and further shorten the convergence time.
[0110] On the basis of any of the above embodiments, the network device further comprises a protocol software module, and the method further comprises:
[0111] The driving software module is controlled to send the fault information and the second link activation state information to the protocol software module, so that the protocol software module updates the network topology and sends the updated topology information to the driving software module, and the updated topology information is used to instruct the driving software module to update the configuration information of the hardware module, and the configuration information includes link priority data, backup link redundancy identification, and interface state synchronization data.
[0112] It should be noted that the embodiment shows the logic of updating the protocol state and information, updating the driving software information, and then updating other hardware information, to solve the problem of network state consistency after driving priority switching.
[0113] In particular, the drive software module sends "fault information + second link activation state information" (such as "link a: physically disconnected; link b: active available") to the protocol software module after the hardware module completes the entry switching; the protocol software module updates the network topology based on the above information (such as marking link a as "fault" and link b as "active"); the protocol software module sends the updated topology information (including configuration information) to the drive software module; and the drive software module updates the configuration information of the hardware module based on the topology information, to ensure that the hardware fast switching and the protocol state synchronization do not conflict and do not cause network instability.
[0114] It should be understood that the protocol software module refers to a software component responsible for network topology management, route calculation, and link state synchronization (such as a software platform running redundancy protocols such as STP and VRRP), which can update the network topology based on the fault information and feed back configuration instructions to the drive software module.
[0115] The second link activation state information is used to indicate state data that the second link has been switched from "inactive" to "active" (such as "link b: active available").
[0116] The configuration information refers to parameters that need to be synchronized to the hardware module after the protocol software module updates the topology, including but not limited to:
[0117] Link priority data: the priority of each link after updating (such as link b priority changed from "low" to "high");
[0118] Backup link redundancy identifier: marking the currently available backup link (such as "link c is the backup link of link b");
[0119] Interface state synchronization data: the current state of each outgoing interface (such as "outgoing interface 1: fault unavailable, outgoing interface 2: active available").
[0120] In this embodiment, by supplementing the protocol software module and drive synchronization information-protocol updating topology-drive completing hardware configuration process, on the basis of the drive priority realizing hardware fast switching, the network topology and the hardware configuration are ensured to be consistent, the problem of network state confusion caused by directly switching hardware without passing through the protocol layer is solved, the dual goals of fast switching and network stability are realized, and at the same time, by clearly specifying the specific content of the configuration information, clear guidance is provided for hardware configuration completion.
[0121] On the basis of any of the above embodiments, the protocol software module updates the network topology by the following steps:
[0122] Based on the fault information, the first link is marked as a fault state, and based on the second link activation state information, the second link is marked as an available state;
[0123] generate an updated network topology graph based on the pre-stored connection relationship of each switch port, the failure state of the first link, and the available state of the second link;
[0124] synchronize the updated network topology graph to the driving software module.
[0125] It should be noted that the dual-link architecture of SW1 and SW2 is taken as an example:
[0126] The state marking refers to that after the protocol software module receives the failure information, the identification of the first link (such as "Link_A_001") is extracted and marked as failure unavailable, and the identification of the second link (such as "Link_B_001") is extracted and marked as active available.
[0127] Specifically, the pre-stored connection relationship table of each switch port (such as "SW1's Gi1 / 0 / 1 connects SW2's Gi1 / 0 / 1, SW1's Gi1 / 0 / 2 connects SW2's Gi1 / 0 / 2") is called, combined with the above state marking, the association relationship of "link a-port Gi1 / 0 / 1" in the original topology is corrected, and an updated topology graph (such as "SW1→Gi1 / 0 / 2→link b→SW2's Gi1 / 0 / 2") is generated. The updated topology graph is synchronized to the driving software module in JSON format to ensure that the topology cognition of the driving and the protocol is consistent.
[0128] In this embodiment, by refining the "marking state-generating topology graph-synchronizing driving" three-step process of the protocol software module updating the network topology, combined with the pre-stored connection relationship of the switch port, it is ensured that the protocol layer can accurately and efficiently complete the network topology update, avoid topology errors or update delay caused by ambiguous topology update logic, provide accurate topology basis for the driving software module to complete the hardware configuration, and further guarantee the consistency of the network state.
[0129] On the basis of any of the above embodiments, the driving software module updates the configuration information of the hardware module by the following steps:
[0130] synchronize the link priority data, backup link redundancy identification, and interface state of the updated network topology to the hardware module.
[0131] It should be understood that the link priority data, backup link redundancy identification, and interface state of the updated network topology are synchronized to the hardware module in order to cover the historical topology association configuration in the hardware module.
[0132] As an example, the driver software module receives the configuration information (such as "link b priority: high; backup link: link c; interface 2: active") sent by the protocol software module; the driver software module calls the SDK, writes the link priority data, backup link redundancy identifier, and interface state synchronization data into the configuration register of the hardware module; the hardware module covers the original historical topology associated configuration with the new configuration (such as the original "link a priority: high" is replaced by "link b priority: high"), to ensure that the hardware configuration is completely synchronized with the protocol topology, and avoid state inconsistency.
[0133] In the embodiment, by explicitly indicating the specific content of the hardware configuration updated by the driver software module (i.e. link priority, backup link redundancy identifier, and interface state), it is ensured that the hardware module can completely synchronize the topology information updated by the protocol layer, cover the historical redundancy configuration, avoid the forwarding abnormality caused by the conflict between the old configuration and the new topology, further consolidate the foundation of network state consistency, and guarantee the long-term stable operation of the link after switching.
[0134] On the basis of any of the above embodiments, the method further comprises:
[0135] If the first link state data exceeds the preset failure proximity threshold and it is determined based on the first link state data that the first link is not completely failed, the driver software module is controlled to call the software development kit and send a hardware table item configuration instruction to the hardware module; the hardware table item configuration instruction is used to instruct the hardware module to simultaneously retain the hardware table items of the first interface and the second interface.
[0136] It should be noted that the preset failure proximity threshold refers to a warning threshold lower than the failure threshold (for example, if the failure threshold is an error rate of 1% and a time delay of 100 ms, the failure proximity threshold can be set to an error rate of 0.8% and a time delay of 80 ms), and the preset failure proximity threshold is used to perceive the link deterioration trend in advance.
[0137] The hardware table item configuration instruction refers to an instruction sent by the driver software module to the hardware module for retaining the master and backup interface table items (such as "retain the forwarding table items of interface 1 and interface 2, and preferentially use interface 1").
[0138] As an example, the hardware module monitors that the error rate of link a reaches 0.8% (exceeds the failure proximity threshold 0.8% and does not reach the failure threshold 1%), determines that link a is in a proximity failure but not in a complete failure, sends the state data to the driver software module, and the driver software module calls the SDK and sends the hardware table item configuration instruction to the hardware module. After receiving the instruction, the hardware module retains the hardware table items of the interface 1 (link a) and the interface 2 (link b) at the same time, and configures the "preferentially forwarding through the interface 1", and when the error rate of link a reaches 1% (complete failure) subsequently, the hardware module can directly switch to the interface 2 for forwarding without re-generating the table item, so as to further shorten the outage time.
[0139] Optionally, if the first link state data exceeds the preset failure proximity threshold and it is determined based on the first link state data that the first link is not in a complete failure, the driver software module is controlled to call the software development kit and send a hardware table item configuration instruction to the hardware module; the hardware table item configuration instruction is used to instruct the hardware module to retain the hardware table items of the first interface and the second interface at the same time, and configure the forwarding priority of the hardware table item - preferentially forwarding the packet through the first interface; when the hardware module monitors that the first link is in a complete failure (the physical layer on-off signal is in a disconnected state or the state data exceeds the preset failure threshold), the hardware module immediately switches to the second link for forwarding the packet based on the retained second interface table item.
[0140] In the embodiment, the failure prediction mechanism of retaining the main and backup interface table items when the newly added link is in a proximity failure is used to complete the backup table item configuration in advance when the link is not in a complete failure, so that the table item does not need to be re-generated when the link is in a complete failure, and the switching can be immediately performed, thereby further shortening the outage time.
[0141] On the basis of any of the above embodiments, the failure information includes the identification, the failure type, and the timestamp of the failure occurrence of the first link.
[0142] It should be noted that the identification of the first link refers to a number used to uniquely distinguish the first link (such as "Link_A_001", "SW1-SW2_Link1", and the like).
[0143] The failure type is used to describe the specific reason classification of the link failure (such as physical disconnection, high error rate, time delay, and the like).
[0144] The timestamp of the failure occurrence refers to the specific time when the hardware module determines the link failure (such as "2024-05-2014:30:00.123").
[0145] The failure information includes the identification, the type, and the timestamp, and has the following advantages:
[0146] The protocol software module accurately locates the fault link through the identification of the first link, and avoids topology update misplacement.
[0147] A targeted recovery strategy is selected according to the fault type (for example, physical disconnection needs to inform the operation and maintenance personnel to troubleshoot, and high error rate can try link restart).
[0148] The timestamp records the fault occurrence sequence, which facilitates subsequent network fault tracing and analysis, and provides support for protocol layer processing and operation and maintenance management.
[0149] In a specific implementation, there are two links between the switches sw1 and sw2. Under normal circumstances, after the switch is configured with a protocol, the network topology is discovered through the protocol, the master and backup links are selected according to certain rules, the forwarding information is formed, and the driving platform is issued. The driving platform issues hardware table items, and the traffic is forwarded according to the hardware table items. Referring to Figure 2 , one main link (i.e., link a) and one backup link (i.e., link b), under normal conditions, link a is in an active state and performs normal forwarding traffic; link b is in an inactive state and has no traffic, and the port is blocked. Referring to , the hardware table items are formed to guide the traffic forwarding.
[0150] Referring to Figure 3 , when link a fails, the driver first senses the fault and reports the protocol platform for updating. The platform updates the network topology to reselect the port, activates the backup b link, and refreshes the information to issue the driving platform according to the original process. The driving issues hardware to guide the forwarding of network packets. After the link a fault, the network device realizes convergence after three steps.
[0151] Referring to Figure 4 , since the link fault driver first senses, it can directly issue hardware first, forcibly flush the hardware table items to make the egress port 2, which is much faster than reporting the link fault, updating the protocol, then issuing the driver, and then updating the hardware table items, so that the flow interruption time is shortened and the entire link convergence is accelerated. The process in Figure 4 is followed to update the protocol state and information, update the driving software information, and then flush the hardware other information. The normal egress interface is directly covered twice and is not affected.
[0152] It should be understood that the above embodiments and the switch link switching method shown in the present embodiment directly bypass the protocol to switch the hardware table items, which does not cause network instability. The method flushes the hardware in advance, changes the forwarding table egress port, reduces packet loss, and the fault still follows the reporting. Each layer protocol is normally processed, the protocol state is switched, and the hardware state is checked after the hardware is flushed. If the read-out is consistent with the flushed hardware, the hardware does not need to be flushed repeatedly.
[0153] In addition, the method can realize pre-judgment of failure, specifically: when it is detected that the link a index is close to the failure threshold, instead of complete failure, the pre-switch is triggered in advance, and the soft effect state of the standby exit table item is driven to be issued first (that is, the hardware table item retains the main and standby exits at the same time, the main exit is preferentially used, and only when the main exit is completely disabled, the standby exit is switched to immediately), further shortening the flow interruption time.
[0154] In the embodiment, by explicitly including the link identifier, the failure type and the timestamp in the failure information, accurate positioning of the failure link and selection of a targeted recovery strategy are provided for the protocol software module, complete information is provided for subsequent network failure tracing and analysis, and reliable data support is provided, so that the fault reason is convenient for the maintenance personnel to troubleshoot.
[0155] Based on the method described in any of the above embodiments, the application further provides an electronic device as shown in Figure 5 As shown in Figure 5 At the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory and a non-volatile memory, and of course can also include other hardware required by the business. The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs to implement the method described in any of the above embodiments.
[0156] Based on the method described in any of the above embodiments, the application further provides a computer storage medium, the storage medium stores a computer program, and the computer program is executed by a processor to implement the method described in any of the above embodiments.
[0157] Based on the method described in any of the above embodiments, the application further provides a computer program product, the computer program product includes one or more computer programs or instructions. The computer program or instruction can be stored in a computer readable storage medium, or transmitted from one computer readable storage medium to another computer readable storage medium. The computer program is executed by the processor to implement the method described in any of the above embodiments.
[0158] In several embodiments provided in the present application, it should be understood that the disclosed apparatus and method can also be implemented by other manners. The apparatus embodiments described above are merely illustrative, for example, the flowcharts and block diagrams in the drawings show the possible implementation architecture, function and operation of the apparatus, method and computer program product according to the embodiments of the present application. In this regard, each block in the flowchart or block diagram can represent a module, a program segment or a part of code, which contains one or more executable instructions for implementing the specified logic function. It should also be noted that in some alternative implementation manners, the functions noted in the blocks can also occur in different order from that noted in the drawings. For example, two consecutive blocks can actually be executed substantially in parallel, and they can also be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for executing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0159] In addition, each functional module in the embodiments of the present 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.
[0160] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, and the computer software product is stored in a storage medium, and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the embodiments of the present application. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0161] The above only describes the embodiments of the present application and does not limit the protection scope of the present application. For those skilled in the art, the present application can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application. It should be noted that similar reference numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.
[0162] The above descriptions are merely specific embodiments of the present application, but the protection scope of the present application is not limited thereto, and any person skilled in the art can easily think of changes or replacements within the technical scope disclosed by the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
[0163] It should be noted that the relational terms herein such as first and second and the like are used solely to distinguish one entity or action from another, without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises", "comprising", or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without limitation, an element preceded by "comprises... a" does not, without more constraints, foreclose the existence of additional identical elements in the process, method, article, or apparatus.
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. 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.
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 any one of claims 1-7, characterized in that, The fault information includes the identifier of the first link, the fault type, and the timestamp of the fault occurrence.
9. 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-8.
10. 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-8.
11. 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-8.
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