Port failover method, device, forwarding element, network card and network device

CN122933389APending Publication Date: 2026-10-16WUXI STARS MICRO SYSTEM TECHNOLOGIES CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611132686.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-28
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

[0002]随着大规模人工智能(Artificial Intelligence,AI)训练的高速发展,以及图形处理器(Graphics Processing Unit,GPU)的算力提升,网卡单位时间内需要交换的数据和带宽消耗也随之提高,同时这也带来了部分链路高负载、利用率低、聚合带宽不够的问题

Benefits of technology

[0035] In the aforementioned port failover methods, devices, forwarding units, network interface cards (NICs), and network devices, when a link anomaly or link congestion is detected on the physical port corresponding to the data packet to be forwarded, there is no need to report the fault information to the CPU for processing. Instead, the forwarding unit hardware layer retrieves the locally stored port mapping configuration table to quickly match the faulty physical port with its corresponding logical port and update the logical port information in the port list. This significantly shortens the port status update time, reduces resource consumption and forwarding latency caused by CPU scheduling, and improves the processing response speed under port failure conditions. Furthermore, by selecting target physical ports that are operating normally or in an idle state based on the updated port list to forward data packets, faulty forwarding paths can be automatically avoided, ensuring that data packets are forwarded completely.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122933389A_ABST
    Figure CN122933389A_ABST
Patent Text Reader

Abstract

The application relates to a port fault switching method, device, forwarding unit, network card and network equipment. The method comprises the following steps: in the case that a fault exists in a physical port corresponding to a data packet to be forwarded, updating logical port information in a target port list according to a port mapping configuration table; the port mapping configuration table is used for representing a mapping relationship between the physical port and the logical port; determining a target physical port according to the updated target port list; and forwarding the data packet according to the target physical port. The port fault switching method of the application can be completed by local hardware, does not need to involve a CPU, and can greatly shorten the port switching time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and in particular to a port fault switching method, apparatus, forwarding unit, network card, and network device. Background Technology

[0002] With the rapid development of large-scale artificial intelligence (AI) training and the improvement of computing power of graphics processing units (GPUs), the amount of data exchanged and the bandwidth consumption of network cards per unit time have also increased. This has also led to problems such as high load, low utilization, and insufficient aggregate bandwidth on some links.

[0003] Currently, port fault detection and switching often rely on software mechanisms. When a port fault occurs, the hardware chip first reports the fault to the software layer (e.g., CPU). The software layer detects the fault, removes the faulty port from the port list, and then recalculates based on the Equal-Cost Multipath Routing (ECMP) mechanism to allocate the data flow to the valid link, updates the forwarding table, and sends the updated forwarding table to the hardware chip to achieve port switching. This process is time-consuming. Summary of the Invention

[0004] Therefore, it is necessary to provide a port fault switching method, apparatus, forwarding unit, network card, and network device that can achieve rapid switching to address the above-mentioned technical problems.

[0005] Firstly, this application provides a port failover method, including:

[0006] If the physical port corresponding to the data packet to be forwarded is faulty, the logical port information in the target port list is updated according to the port mapping configuration table; the port mapping configuration table is used to represent the mapping relationship between physical ports and logical ports.

[0007] Determine the target physical port based on the updated target port list;

[0008] Forward data packets based on the target physical port.

[0009] In one embodiment, updating the logical port information in the target port list according to the port mapping configuration table includes:

[0010] Determine the faulty logical port based on the port mapping configuration table and the physical port corresponding to the data packet;

[0011] Update the port status of the faulty logical port in the target port list to the faulty status; or remove the faulty logical port from the target port list.

[0012] In one embodiment, determining the target physical port based on the updated target port list includes:

[0013] Select a port whose status is not faulty from the updated target port list and determine it as the target logical port; or, select a logical port from the updated target port list and determine it as the target logical port.

[0014] Determine the target physical port based on the port mapping configuration table and the target logical port.

[0015] In one embodiment, forwarding data packets based on the target physical port includes:

[0016] Based on the preset port path table, determine the target path corresponding to the target physical port;

[0017] Data packets are forwarded through the target physical port along the target path.

[0018] In one embodiment, the method further includes:

[0019] In the same data stream, if the time interval between the reception time of the data packet to be forwarded and the reception time of the previous data packet exceeds a preset time interval, the operating information of the physical port corresponding to the data packet to be forwarded is obtained.

[0020] Determine whether the physical port corresponding to the data packet to be forwarded is faulty based on the operation information.

[0021] In one embodiment, the method further includes:

[0022] Obtain operational information for each physical port in the network device;

[0023] If a faulty port is identified based on the operational information, the logical port information in the initial port list is updated according to the port mapping configuration table to obtain the target port list.

[0024] In one embodiment, the operational information includes port connection information and port queue cache information;

[0025] The method also includes:

[0026] If the port connection information indicates an abnormal port connection, the corresponding physical port is identified as the faulty port; and / or,

[0027] If the port queue cache information indicates that the port is congested, the corresponding physical port is identified as the faulty port.

[0028] Secondly, this application also provides a port fault switching device, comprising:

[0029] The update module is used to update the logical port information in the target port list according to the port mapping configuration table when the physical port corresponding to the data packet to be forwarded is faulty; the port mapping configuration table is used to represent the mapping relationship between physical ports and logical ports.

[0030] The switching module is used to determine the target physical port based on the updated target port list;

[0031] The forwarding module is used to forward data packets based on the target physical port.

[0032] Thirdly, this application also provides a forwarding unit, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the port fault switching method provided in any of the above embodiments.

[0033] Fourthly, this application also provides a network interface card (NIC) that includes the forwarding unit provided in any of the above embodiments.

[0034] Fifthly, this application also provides a network device, which includes the network interface card provided in any of the above embodiments, or includes the forwarding unit provided in any of the above embodiments.

[0035] In the aforementioned port failover methods, devices, forwarding units, network interface cards (NICs), and network devices, when a link anomaly or link congestion is detected on the physical port corresponding to the data packet to be forwarded, there is no need to report the fault information to the CPU for processing. Instead, the forwarding unit hardware layer retrieves the locally stored port mapping configuration table to quickly match the faulty physical port with its corresponding logical port and update the logical port information in the port list. This significantly shortens the port status update time, reduces resource consumption and forwarding latency caused by CPU scheduling, and improves the processing response speed under port failure conditions. Furthermore, by selecting target physical ports that are operating normally or in an idle state based on the updated port list to forward data packets, faulty forwarding paths can be automatically avoided, ensuring that data packets are forwarded completely. Attached Figure Description

[0036] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0037] Figure 1This is an application environment diagram of a port failover method in one embodiment;

[0038] Figure 2 This is a flowchart illustrating a port failure switching method in one embodiment;

[0039] Figure 3 This is a schematic diagram of the process for updating the port list in one embodiment;

[0040] Figure 4 This is a flowchart illustrating the process of reselecting the target physical port in one embodiment;

[0041] Figure 5 This is a schematic diagram of the process for updating the port list in another embodiment;

[0042] Figure 6 This is a flowchart illustrating the periodic monitoring of port status in one embodiment;

[0043] Figure 7 This is a flowchart illustrating a port failure switching method in another embodiment;

[0044] Figure 8 This is a structural block diagram of a port fault switching device in one embodiment;

[0045] Figure 9 This is an internal structure diagram of the forwarding unit in one embodiment. Detailed Implementation

[0046] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0047] It should be noted that the terms "comprising" and "having," and any variations thereof, as used in this application, are intended to cover non-exclusive inclusion. The term "multiple" as used in this application refers to two or more. The term "and / or" as used in this application refers to one of the solutions, or any combination of multiple solutions.

[0048] The port fault switching method provided in this application embodiment can be applied to, for example, Figure 1The application environment shown includes a transmitter 102, a receiver 104, and a forwarding unit 106 located between the transmitter 102 and the receiver 104. The transmitter 102 and receiver 104 are computer devices participating in distributed training, such as servers configured with GPUs and host network interface cards. The forwarding unit 106 is used to forward data between the transmitter 102 and the receiver 104. The forwarding unit 106 can be, for example, a Leaf switch and a Spine switch. The Leaf switch is directly connected to the server, and the Spine switch is fully connected to the Leaf switch, forming a multi-path forwarding architecture.

[0049] In one exemplary embodiment, such as Figure 2 As shown, a port failure switching method is provided, which can be applied to... Figure 1 The following steps are used as an example of the forwarding unit in the process, including steps 202 to 206.

[0050] Step 202: If the physical port corresponding to the data packet to be forwarded is faulty, update the logical port information in the target port list according to the port mapping configuration table; the port mapping configuration table is used to represent the mapping relationship between physical ports and logical ports.

[0051] A data packet is the basic data unit for network transmission. It can be in the form of a five-tuple, which includes the source IP address, destination IP address, source port, destination port, and transport layer protocol. A data packet to be forwarded can be a data packet that has been received but not yet forwarded, or a data packet that will be received and forwarded.

[0052] A physical port is the hardware output port of the forwarding unit. A logical port is a virtual port generated by the forwarding unit to implement equal-cost routing, multi-path forwarding, and load balancing scheduling. Port failures refer to various port failures that the forwarding unit can autonomously identify that affect the efficiency of packet forwarding. These can include physical link failures (such as disconnected port connections, abnormal port connections, loss of hardware monitoring port signals, etc.) and congestion failures.

[0053] The target port list is stored within the forwarding unit and is a collection of logical ports under the same ECMP group within the forwarding unit. Before the first update, the target port list is the initial port list stored within the forwarding unit, which has not undergone port deletion or port status update processing; after the first update, the target port list is the port list after the last update. Port information includes information about each logical port contained in the port list, which may include the number of logical ports, their numbers, status values, etc. Port status values ​​are associated with the operating status of physical ports, and can be up or down. Up indicates that the physical port corresponding to the logical port is operating normally or the port is idle, while down indicates that the physical port corresponding to the logical port is closed, offline, congested, or severely congested.

[0054] The port mapping configuration table is pre-stored in the forwarding unit, containing the mapping relationship between physical ports and logical ports.

[0055] When the forwarding unit detects that the physical port corresponding to the data packet to be forwarded is faulty, it does not need to report to the software layer (CPU). Instead, it can directly match the logical port corresponding to the physical port through the port mapping configuration table and update the port information of the logical port in the target port list. For example, it can directly remove the logical port from the target port list or mark the logical port as faulty.

[0056] Step 204: Determine the target physical port based on the updated target port list.

[0057] The target physical port is a port that is operating normally or idle in the forwarding unit. When the port corresponding to the data packet to be forwarded is faulty, the forwarding unit can select a valid logical port from the updated target port list and use the physical port corresponding to that valid logical port as the target physical port.

[0058] Step 206: Forward data packets according to the target physical port.

[0059] After determining the target physical port, the forwarding unit completely migrates the data packet to be forwarded to the forwarding queue of the target physical port, inheriting the original five-tuple information, message encapsulation structure, etc. of the data packet, without modifying the original data content and forwarding attributes of the data packet.

[0060] In this embodiment, when a link anomaly or congestion is detected on the physical port corresponding to the data packet to be forwarded, there is no need to report the fault information to the CPU for processing. Instead, the forwarding unit hardware layer retrieves the locally stored port mapping configuration table to quickly match the faulty physical port with the corresponding logical port and update the logical port information in the target port list. This significantly shortens the port status update time, reduces resource consumption and forwarding latency caused by CPU scheduling, and improves the processing response speed under port fault conditions. Furthermore, by selecting normally operating or idle target physical ports from the updated port list to forward data packets, faulty forwarding paths can be automatically avoided, ensuring that data packets are forwarded completely.

[0061] In one exemplary embodiment, such as Figure 3 As shown, the logical port information in the target port list is updated according to the port mapping configuration table, including the following steps 302-304.

[0062] Step 302: Determine the faulty logical port based on the port mapping configuration table and the physical port corresponding to the data packet.

[0063] A faulty logical port is the logical port corresponding to a physical port that is faulty. The forwarding unit can match the faulty logical port in the port mapping configuration table based on the physical port corresponding to the data packet.

[0064] Step 304: Update the port status of the faulty logical port in the target port list to the faulty status.

[0065] The forwarding unit can update the port status of the faulty logical port in the target port list to a faulty status, for example, update the status value of the faulty logical port to down, in order to indicate that the physical port corresponding to the logical port has a link abnormality, congestion, signal loss or other faults, and will no longer participate in subsequent ECMP hash routing.

[0066] In this embodiment, the forwarding unit determines the faulty logical port corresponding to the faulty physical port through the port mapping configuration table stored locally, and updates the faulty logical port in the target port list to the faulty state. Without the CPU's involvement, the port state update time can be greatly reduced.

[0067] In one exemplary embodiment, such as Figure 4 As shown, the target physical port is determined based on the updated target port list, including the following steps 402-404.

[0068] Step 402: Determine the ports in the updated target port list whose port status is non-faulty as target logical ports.

[0069] Non-fault states include idle state and normal operation state. In this embodiment, the updated target port list includes logical ports indicating fault states and logical ports indicating non-fault states. The forwarding unit can select ports with non-fault states from the updated target port list as target logical ports.

[0070] In addition, the forwarding unit can also determine the target logical port from the non-faulty ports according to the ECMP group's preset scheduling policy. The preset scheduling policy can be to prioritize idle logical ports, or to determine the target logical port only by hash routing of the data packets to be forwarded.

[0071] Step 404: Determine the target physical port based on the port mapping configuration table and the target logical port.

[0072] The forwarding unit can retrieve the port mapping configuration table and match the target physical port corresponding to the target logical port.

[0073] In this embodiment, the forwarding unit can identify ports in the updated target port list that are in a non-faulty state as target logical ports, and then determine the target physical port based on the port mapping configuration table and the target logical port. This eliminates the need for the CPU to recalculate and switch ports, thus achieving fast port switching.

[0074] In one exemplary embodiment, such as Figure 5 As shown, the logical port information in the target port list is updated according to the port mapping configuration table, including the following steps 502-504.

[0075] Step 502: Determine the faulty logical port based on the port mapping configuration table and the physical port corresponding to the data packet.

[0076] Step 502 can be referred to the description of step 302 above, and will not be repeated here.

[0077] Step 504: Remove the faulty logical port from the target port list.

[0078] The forwarding unit can directly remove the faulty logical port from the port list, causing the faulty logical port to exit the ECMP queue.

[0079] Further, the target physical port is determined based on the updated target port list, including selecting a logical port from the updated target port list as the target logical port, and determining the target physical port based on the port mapping configuration table and the target logical port.

[0080] After removing the faulty logical port from the target port list, all logical ports in the list become valid. The forwarding unit can directly select one logical port as the target logical port. This selection process can either prioritize idle logical ports or calculate the hash value based on the five-tuple of the data packet to be forwarded and reallocate the path accordingly. Afterward, the target physical port can be determined by matching the target logical port against the port mapping configuration table, enabling rapid port switching.

[0081] In one exemplary embodiment, forwarding data packets according to a target physical port includes the steps of determining the target path corresponding to the target physical port according to a preset port path table, and forwarding data packets through the target physical port according to the target path.

[0082] The preset port path table contains the mapping relationship between logical ports and network forwarding paths. After determining the target logical port, the forwarding unit can retrieve the local preset port path table, use the selected target logical port as the query index, match and query to obtain the network forwarding path pre-bound to the target logical port, determine the matching forwarding path as the target path, and then forward data packets through the target physical port according to the target path.

[0083] In an exemplary embodiment, the port failover method further includes, in the same data stream, if the time interval between the reception time of the data packet to be forwarded and the reception time of the previous data packet exceeds a preset time interval, obtaining the operating information of the physical port corresponding to the data packet to be forwarded; and determining whether the physical port corresponding to the data packet to be forwarded is faulty based on the operating information.

[0084] The same data stream typically refers to data packets identified by the same 5-tuple (source IP, destination IP, source port, destination port, protocol number). The reception time is the time when the forwarding unit receives the data packet. The forwarding unit stores a micro-flow table (flowlet table) recording parameters such as the data packet's output port (physical port), reception timestamp, and output port validity flag. The initial values ​​of each parameter in the micro-flow table are sent to the forwarding unit by the software layer and can be updated based on the data sent by the software layer. For example, if the software layer detects a fault in a certain output port, it can send updated data to the forwarding unit to update the corresponding output port validity flag to invalid.

[0085] In addition, the forwarding unit can also automatically update the content corresponding to the data packet in the microflow table. For example, after receiving the data packet, it can record or update the data packet's reception timestamp; if it is determined that the original outgoing port corresponding to the data packet is faulty, it can update the outgoing port validity mark from valid to invalid; after port switching, it can update the outgoing port of the data packet from the original port to the target physical port and update the corresponding outgoing port validity mark to valid.

[0086] Operational information refers to various monitoring data that reflect the actual operating status of physical ports, including port connection information and port queue cache information.

[0087] The forwarding unit retrieves the timestamp of the previous data packet received from the microflow table to predict whether the time interval between the reception time of the current data packet to be forwarded and the reception time of the previous adjacent data packet exceeds a preset time interval. If it is determined that the reception time interval exceeds the preset time interval, the forwarding unit actively obtains the operating information of the physical port bound to the current data packet to be forwarded, and determines whether the corresponding physical port is faulty based on the operating information.

[0088] In this embodiment, by performing port status verification in advance when the data packet interval times out within the flow, when the data packet to be forwarded is received, the forwarding unit can directly perform routing forwarding based on the pre-determined port status and the updated target port list, without having to temporarily check the port status after receiving the data packet to be forwarded, which can improve forwarding efficiency.

[0089] In one exemplary embodiment, determining the target physical port based on the updated port list further includes the step of determining the target physical port based on the updated target port list and the microflow table.

[0090] The forwarding unit can determine candidate logical ports based on the updated target port list and query the microflow table to check if the corresponding outgoing port validity flag of the candidate logical port is valid. If the outgoing port validity flag is valid, the candidate logical port is determined as the target logical port, and the corresponding target physical port is determined through the port mapping configuration table. If the outgoing port validity flag is invalid, a new candidate logical port can be selected from the updated target port list for further evaluation.

[0091] In one exemplary embodiment, periodic global inspections can also be performed on each physical port to proactively identify and troubleshoot faults. For example... Figure 6 As shown, the port fault switching method also includes the following steps 602-604.

[0092] Step 602: Obtain the operating information of each physical port in the network device.

[0093] Network devices include hardware devices with forwarding units. The forwarding unit can periodically monitor the operational information of each physical port in the network device according to a pre-set monitoring cycle.

[0094] Step 604: If a faulty port is determined based on the running information, the logical port information in the initial port list is updated according to the port mapping configuration table to obtain the target port list.

[0095] The initial port list refers to the logical port list that has not undergone port deletion or port status update processing. The forwarding unit identifies the operating information of each physical port collected. When an abnormal or congested physical port is identified, it can directly call the locally stored port mapping configuration table without waiting for data packet reception and traffic triggering. Based on the mapping relationship between physical ports and logical ports, it determines the logical port corresponding to the faulty physical port. Then, according to the aforementioned port information update method, it updates the logical port information in the initial port list to obtain the target port list. This completes the early marking or removal of faulty ports, blocks abnormal forwarding channels in advance, and completes link optimization configuration in advance for subsequent data packet forwarding.

[0096] In an exemplary embodiment, the port failover method further includes determining the corresponding physical port as a faulty port when the port connection information indicates that the port connection is abnormal; and / or determining the corresponding physical port as a faulty port when the port queue cache information indicates that the port is congested.

[0097] Port connection information refers to monitoring data that indicates whether a port is properly connected; for example, it could be a PHY link signal. When the port connection information indicates an abnormal port connection, such as a disconnected port or a port being shut down, the corresponding physical port is identified as the faulty port.

[0098] Port queue cache information is monitoring data that characterizes whether a port cache is congested, such as the port queue cache depth. The forwarding unit can determine port congestion and designate the corresponding physical port as a faulty port if the port queue cache depth exceeds a preset depth threshold. Furthermore, the forwarding unit can set multiple depth thresholds to correspond to port states such as idle, normal, congested, and severely congested, enabling accurate judgment of the port cache status.

[0099] In one exemplary embodiment, such as Figure 7 As shown, the port failure switching method of this application includes updating the port list during the periodic inspection phase and updating during the traffic timeout trigger phase.

[0100] The periodic inspection phase can be performed by the forwarding unit at regular intervals. That is, the forwarding unit can periodically obtain the operating information of each physical port in the network device. If the operating information indicates that the port connection is abnormal or the port is congested, the corresponding physical port is identified as the faulty port, and the logical port information in the initial port list is updated according to the port mapping configuration table to obtain the target port list.

[0101] The traffic timeout trigger phase occurs during data packet transmission. Specifically, when the forwarding unit receives a data packet to be forwarded, if the time interval between the reception time of the data packet to be forwarded and the reception time of the previous data packet exceeds a preset time interval, it immediately obtains the operating information of the physical port corresponding to the data packet to be forwarded. Based on the operating information, it determines whether the physical port corresponding to the data packet to be forwarded is faulty. If the physical port corresponding to the data packet to be forwarded is faulty, the logical port information corresponding to the faulty physical port in the target port list can be updated according to the port mapping configuration table.

[0102] In this embodiment, on the one hand, by periodically collecting operational information from each physical port, various port faults such as abnormal port connections, abnormal PHY link signals, and port congestion can be identified in advance, allowing for early updates of logical port information and proactive fault prediction. On the other hand, relying on the data packet reception time interval as a trigger condition, the status of the corresponding port is specifically verified in scenarios where data flow interruption timeouts occur, compensating for the detection gaps and blind spots in periodic inspections and improving the comprehensiveness and timeliness of port fault identification. Furthermore, the entire process can be completed by the forwarding unit without CPU intervention, reducing resource consumption and forwarding latency caused by CPU scheduling, significantly shortening the port status update time, and thus improving the processing response speed under port fault conditions.

[0103] In one embodiment, in addition to considering whether the port is faulty, the pre-stored ECMP group preset scheduling policy within the forwarding unit also needs to be considered when performing port switching. The ECMP group preset scheduling policy includes, for example, Policy 1: no port switching; Policy 2: always switch to the optimal path regardless of the situation; Policy 3: only perform port switching if the time interval between the reception time of the packet to be forwarded and the reception time of the previous packet exceeds a preset time interval, etc. Furthermore, both Policy 1 and Policy 3 include forcing port switching if a port fault is determined.

[0104] That is, if the physical port corresponding to the data packet to be forwarded is normal and the ECMP group's preset scheduling policy is Policy 1, or if the physical port corresponding to the data packet to be forwarded is normal, the ECMP group's preset scheduling policy is Policy 3, and the time interval between the reception times of adjacent data packets does not exceed the preset time interval, the data packet to be forwarded will be sent through the original physical port.

[0105] If the physical port corresponding to the data packet to be forwarded is normal, the ECMP group's preset scheduling policy is Policy 2, or the physical port corresponding to the data packet to be forwarded is normal, the ECMP group's preset scheduling policy is Policy 3, and the time interval between the reception times of adjacent data packets exceeds the preset time interval, or the physical port corresponding to the data packet to be forwarded is faulty, a port switch will be performed. That is, a new target physical port will be determined according to the target port list, so that the data packet can be forwarded through the new target physical port.

[0106] In this embodiment, when performing port switching, the fault status of the physical port and the preset scheduling strategy of the ECMP group are taken into account. This can avoid the situation where port switching cannot be performed due to port failure caused by a fixed preset scheduling strategy, thereby improving the reliability of the ECMP forwarding mechanism.

[0107] It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.

[0108] Based on the same inventive concept, this application also provides a port fault switching device for implementing the port fault switching method described above. The solution provided by this device is similar to the solution described in the above method; therefore, the specific limitations in one or more port fault switching device embodiments provided below can be found in the limitations of the port fault switching method described above, and will not be repeated here.

[0109] In one exemplary embodiment, such as Figure 8 As shown, a port fault switching device is provided, including: an update module 802, a switching module 804, and a forwarding module 806, wherein:

[0110] The update module 802 is used to update the logical port information in the target port list according to the port mapping configuration table when the physical port corresponding to the data packet to be forwarded is faulty; the port mapping configuration table is used to represent the mapping relationship between physical ports and logical ports.

[0111] Switching module 804 is used to determine the target physical port based on the updated target port list;

[0112] The forwarding module 806 is used to forward data packets based on the target physical port.

[0113] In this embodiment, when a link anomaly or link congestion is detected on the physical port corresponding to the data packet to be forwarded, there is no need to report the fault information to the CPU for processing. Instead, the forwarding unit hardware layer retrieves the locally stored port mapping configuration table to quickly match the faulty physical port with the corresponding logical port and update the logical port information in the target port list. This significantly shortens the port status update time, reduces resource consumption and forwarding latency caused by CPU scheduling, and improves the processing response speed under port fault conditions. Furthermore, by selecting normally operating or idle target physical ports from the updated port list to forward data packets, faulty forwarding paths can be automatically avoided, ensuring that data packets are forwarded completely.

[0114] In an exemplary embodiment, the update module is further configured to determine the faulty logical port based on the port mapping configuration table and the physical port corresponding to the data packet; update the faulty logical port in the target port list to a faulty state; or remove the faulty logical port from the target port list.

[0115] In an exemplary embodiment, the switching module is further configured to determine the ports in the updated target port list that are in a non-fault state as target logical ports; or, select a logical port from the updated target port list as a target logical port; and determine the target physical port according to the port mapping configuration table and the target logical port.

[0116] In an exemplary embodiment, the forwarding module is further configured to determine the target path corresponding to the target physical port according to a preset port path table; and forward data packets through the target physical port according to the target path.

[0117] In an exemplary embodiment, the port fault switching device further includes a fault detection module. The fault detection module is used to obtain the operating information of the physical port corresponding to the data packet to be forwarded when the time interval between the reception time of the data packet to be forwarded and the reception time of the previous data packet exceeds a preset time interval for the same data stream; and determine whether the physical port corresponding to the data packet to be forwarded is faulty based on the operating information.

[0118] In an exemplary embodiment, the fault detection module is further configured to obtain the operating information of each physical port in the network device; if it is determined that there is a faulty port based on the operating information, the logical port information in the initial port list is updated according to the port mapping configuration table to obtain the target port list.

[0119] In an exemplary embodiment, the fault detection module is further configured to determine that the corresponding physical port is a faulty port when the port connection information indicates that the port connection is abnormal; and / or, determine that the corresponding physical port is a faulty port when the port queue cache information indicates that the port is congested.

[0120] Each module in the aforementioned port fault switching device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

[0121] In one exemplary embodiment, a forwarding unit is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the port failover method provided in any of the above embodiments.

[0122] This forwarding unit can be a switch, router, etc., and its internal structure diagram can be as follows: Figure 9 As shown, the forwarding unit includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs stored in the non-volatile storage media. The database stores port mapping configuration tables, port lists, microflow tables, and other data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a port failover method.

[0123] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the forwarding unit applied thereto. A specific forwarding unit may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0124] In one embodiment, this application also provides a network interface card (NIC), which may include the forwarding unit provided in any of the above embodiments.

[0125] In one embodiment, this application also provides a network device, which may include the network interface card provided in any of the above embodiments, or the forwarding unit provided in any of the above embodiments.

[0126] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.

[0127] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.

[0128] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A port fault switching method, characterized in that, The method includes: If the physical port corresponding to the data packet to be forwarded is faulty, the logical port information in the target port list is updated according to the port mapping configuration table; the port mapping configuration table is used to represent the mapping relationship between physical ports and logical ports. Determine the target physical port based on the updated target port list; The data packet is forwarded according to the target physical port.

2. The method according to claim 1, characterized in that, The step of updating the logical port information in the target port list according to the port mapping configuration table includes: The faulty logical port is determined based on the port mapping configuration table and the physical port corresponding to the data packet; Update the port status of the faulty logical port in the target port list to a faulty state; or remove the faulty logical port from the target port list.

3. The method according to claim 2, characterized in that, The step of determining the target physical port based on the updated target port list includes: Select a port whose port status is non-faulty from the updated target port list and determine it as the target logical port; or, select a logical port from the updated target port list and determine it as the target logical port. The target physical port is determined based on the port mapping configuration table and the target logical port.

4. The method according to claim 1, characterized in that, The forwarding of the data packet according to the target physical port includes: The target path corresponding to the target physical port is determined according to the preset port path table; The data packet is forwarded through the target physical port according to the target path.

5. The method according to claim 1, characterized in that, The method further includes: In the same data stream, if the time interval between the reception time of the data packet to be forwarded and the reception time of the previous data packet exceeds a preset time interval, the operating information of the physical port corresponding to the data packet to be forwarded is obtained. Based on the operational information, determine whether the physical port corresponding to the data packet to be forwarded is faulty.

6. The method according to claim 1, characterized in that, The method further includes: Obtain operational information for each physical port in the network device; If a faulty port is determined based on the operational information, the logical port information in the initial port list is updated according to the port mapping configuration table to obtain the target port list.

7. The method according to claim 6, characterized in that, The operational information includes port connection information and port queue cache information; The method further includes: If the port connection information indicates an abnormal port connection, the corresponding physical port is determined to be a faulty port; and / or, If the port queue cache information indicates port congestion, the corresponding physical port is determined to be a faulty port.

8. A port fault switching device, characterized in that, include: The update module is used to update the logical port information in the target port list according to the port mapping configuration table when the physical port corresponding to the data packet to be forwarded is faulty; the port mapping configuration table is used to represent the mapping relationship between physical ports and logical ports. The switching module is used to determine the target physical port based on the updated target port list; The forwarding module is used to forward the data packet according to the target physical port.

9. A forwarding unit, comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.

10. A network interface card (NIC), characterized in that, Includes the forwarding unit as described in claim 9.

11. A network device, characterized in that, It includes the network interface card as described in claim 10, or the forwarding unit as described in claim 9.