Keep-alive method for communication between cards and related device

By dynamically adjusting the sending and receiving waiting periods of keep-alive messages in a distributed system, the problem of untimely keep-alive in chip cascading is solved, enabling rapid fault detection and stable inter-card communication.

CN121907912APending Publication Date: 2026-04-21MAIPU COMM TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-18
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

In existing technologies, chip-cascade keep-alive processing is not timely or convergence takes too long, leading to link oscillation and packet loss. Furthermore, the software keep-alive process cannot flexibly adapt to changes in board status, resulting in excessively long fault detection time.

Method used

By sending keep-alive messages according to a set sending cycle and recording timestamps in a distributed system, the sending and receiving waiting cycles can be dynamically adjusted to adapt to the current state of the board and shorten the fault detection time.

Benefits of technology

It achieves rapid convergence of keep-alive and timely fault detection, avoiding keep-alive failures caused by fixed waiting periods, and improving the stability and reliability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121907912A_ABST
    Figure CN121907912A_ABST
Patent Text Reader

Abstract

The invention provides a keep-alive method for communication between cards and a related device, the method is applied to a first board card in a distributed system, the first board card comprises a processor and a first switching chip in communication connection with the processor, and a second switching chip of a second board card in the distributed system is in communication connection with the first switching chip. The method comprises the steps that in the keep-alive process, if a first board card does not receive a keep-alive confirmation message returned by a second switching chip within a receiving waiting period, the sending period is shortened, so that keep-alive convergence can be achieved quickly, and faults can be perceived in time, and if the first board card can receive the keep-alive confirmation message returned by the second switching chip within the receiving waiting period, the first board card can receive the keep-alive confirmation message returned by the second switching chip within the receiving waiting period. If the two messages are received, the receiving waiting period is adaptively reset to be the time difference value of receiving and sending of the two messages, so that keep-alive can flexibly adapt to the current state of the board card, and keep-alive failure caused by a fixed waiting period when communication between the two chips is normal but the state of the board card is unstable in the prior art is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communications, and more specifically, to a method and related apparatus for keeping SIM cards alive in communication. Background Technology

[0002] In distributed systems, multiple communication boards are typically included. Communication between these boards utilizes chip cascading (also known as stacking) technology, where switching chips carry proprietary protocol messages to enable inter-chip communication. To achieve traffic forwarding in chip cascading scenarios, such as handling known unicast traffic and unknown multicast traffic, it's necessary to obtain the status and information of the chips on each board, including their keep-alive status, chip IDs, and board exit information. A complete forwarding path is then established, ultimately enabling on-demand forwarding of cross-chip traffic.

[0003] Of all the states, the keep-alive state is the most critical, as it ultimately determines the designated chip and port through which chip-cascaded traffic passes. Delayed keep-alive processing or excessively long keep-alive convergence can cause link oscillations and packet loss, leading to problems in the business process.

[0004] The keep-alive function of chip cascading is highly dependent on the switching chip. Existing solutions for hardware-based chip cascading keep-alive have several shortcomings, such as only supporting simple keep-alive and not supporting custom keep-alive message definitions. To ensure the universality of chip cascading keep-alive functionality, most manufacturers currently adopt software-based keep-alive. However, the software keep-alive process has the following drawbacks:

[0005] The reception waiting period for chip-cascaded keep-alive messages is strongly correlated with the current state of the board. If the CPU utilization is high, or the number of messages in a short period of time is large (such as interaction with multiple switching chips in the early stage of keep-alive), it may lead to untimely message processing, exceeding the reception waiting period, and finally causing keep-alive failure.

[0006] The sending and receiving wait periods for chip-cascaded keep-alive messages are either fixed settings or can only be manually modified. Furthermore, these settings often rely on experience to determine a large margin of error, making it impossible to detect the status of the peer switching chip. If the peer fails or the link status is abnormal, a significant amount of time is required to detect keep-alive failure, leading to substantial cross-chip packet loss. Summary of the Invention

[0007] The purpose of this invention is to provide a method and related apparatus for keeping cards alive in communication, so as to improve the problems existing in the prior art.

[0008] The embodiments of the present invention can be implemented as follows:

[0009] In a first aspect, the present invention provides a method for keeping alive inter-card communication.

[0010] A first board applied in a distributed system; the first board includes a processor and a first switching chip communicatively connected to the processor, wherein a second switching chip of a second board in the distributed system is communicatively connected to the first switching chip; the method includes:

[0011] According to the set sending cycle, the first switching chip sends a keep-alive message to the second switching chip, and records the sending timestamp at the same time;

[0012] If no keep-alive confirmation message is received from the second switching chip within the set receiving waiting period and the sending period is equal to the default sending period, then the sending period is reset to the product of the default sending period and a set ratio, and the keep-alive message is sent periodically.

[0013] If a keep-alive acknowledgment message is received from the second switching chip within the receive waiting period, the receive timestamp is recorded, and the time difference between the receive timestamp and the send timestamp is calculated. If the receive waiting period is longer than the default waiting period, the receive waiting period is reset to the time difference.

[0014] Optionally, after the step of resetting the sending period to the product of the default sending period and a set ratio and then continuing to periodically send the keep-alive message, the method further includes:

[0015] After each send of the keep-alive message, if no keep-alive confirmation message is received from the second switching chip at the end of the corresponding receive waiting period and the keep-alive confirmation message is not received in the Kth consecutive receive waiting period, then the keep-alive message will continue to be sent periodically based on the sending period, where K is a positive integer set according to an empirical value.

[0016] Optionally, after the step of resetting the sending period to the product of the default sending period and a set ratio and then continuing to periodically send the keep-alive message, the method further includes:

[0017] If no keep-alive confirmation message is received within K consecutive receive waiting periods, it is determined that a communication failure has occurred between the first switching chip and the second switching chip.

[0018] Optionally, after the step of resetting the reception waiting period to the time difference value, the method further includes:

[0019] If, after sending the keep-alive message, the keep-alive confirmation message is received within the corresponding default waiting period for N consecutive sending cycles, the sending cycle is restored to the default sending cycle; where N is a positive integer set based on empirical values.

[0020] Secondly, the present invention provides a keep-alive device for inter-card communication, applied to a first board in a distributed system; the first board includes a processor and a first switching chip communicatively connected to the processor, and a second switching chip in the distributed system having a second board is communicatively connected to the first switching chip; the device includes:

[0021] The sending module is used to send keep-alive messages from the first switching chip to the second switching chip according to a set sending period, and at the same time record the sending timestamp;

[0022] The adjustment module is used to reset the sending period to the product of the default sending period and a set ratio if no keep-alive confirmation message is received from the second switching chip within the set receiving waiting period and the sending period is equal to the default sending period; the sending module is used to continue to periodically send the keep-alive message.

[0023] The adjustment module is also configured to, if a keep-alive confirmation message is received from the second switching chip within the receiving waiting period, record the receiving timestamp, calculate the time difference between the receiving timestamp and the sending timestamp, and reset the receiving waiting period to the time difference if the receiving waiting period is greater than the default waiting period.

[0024] Thirdly, the present invention provides a board, comprising: a memory and a processor, wherein the memory stores a software program, and the processor is used to execute the software program to implement the keep-alive method for inter-card communication as described in the first aspect above.

[0025] Fourthly, the present invention provides a network device including the board as described in the third aspect above.

[0026] Fifthly, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the card-to-card communication keep-alive method described in the first aspect.

[0027] Compared with the prior art, the present invention provides a keep-alive method and related apparatus for inter-card communication. This method is applied to a first board in a distributed system, the first board including a processor and a first switching chip communicatively connected to the processor. A second switching chip of a second board in the distributed system is communicatively connected to the first switching chip. In this method: a keep-alive message is sent from the first switching chip to the second switching chip according to a set sending period, and a sending timestamp is recorded simultaneously; if no keep-alive acknowledgment message is received from the second switching chip within a set receiving waiting period and the sending period is equal to the default sending period, the sending period is reset to the product of the default sending period multiplied by a set ratio, and the keep-alive message continues to be sent periodically; if a keep-alive acknowledgment message is received from the second switching chip within the receiving waiting period, the receiving timestamp is recorded, and the time difference between the receiving timestamp and the sending timestamp is calculated. If the receiving waiting period is greater than the default waiting period, the receiving waiting period is reset to the time difference. Thus, during the keep-alive process, if the first board does not receive the keep-alive acknowledgment message returned by the second switching chip within the receive waiting period, the sending period will be shortened, enabling the keep-alive to converge quickly and detect faults in a timely manner. If the first board receives the keep-alive acknowledgment message returned by the second switching chip within the receive waiting period, the receive waiting period will be adaptively reset to the time difference between the sending and receiving of the two messages, allowing the keep-alive to flexibly adapt to the current state of the board, avoiding keep-alive failure due to a fixed waiting period when communication between the two chips is normal but the board state is unstable, as is the case in the prior art. Attached Figure Description

[0028] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0029] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of the present invention.

[0030] Figure 2 This is a schematic diagram of another application scenario provided by an embodiment of the present invention.

[0031] Figure 3 This is one of the flowcharts illustrating a keep-alive method for inter-card communication provided in an embodiment of the present invention.

[0032] Figure 4 This is a second flowchart illustrating a method for keeping alive inter-card communication provided in an embodiment of the present invention.

[0033] Figure 5This is a schematic diagram of a keep-alive device for inter-card communication provided in an embodiment of the present invention. Detailed Implementation

[0034] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0035] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0036] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0037] Furthermore, the terms "first" and "second" are used only to distinguish descriptions and should not be interpreted as indicating or implying relative importance.

[0038] It should be noted that, where there is no conflict, the features in the embodiments of the present invention can be combined with each other.

[0039] The application scenarios of this invention will be introduced below.

[0040] This invention mainly relates to a distributed system, which includes multiple boards. Any two boards can belong to the same distributed network device (network devices include switches and routers) or different distributed network devices. Each board includes a processor and at least one switching chip that is communicatively connected to the processor.

[0041] The card-to-card communication keep-alive method provided in this embodiment of the invention can be applied to a first board in a distributed system. The first board can be any board in the distributed system. The first board includes a processor and a first switching chip that is communicatively connected to the processor. The second switching chip of the second board in the distributed system is connected to the first switching chip through a cascaded link.

[0042] The first and second boards can be the same board, or they can be different boards. Therefore, the keep-alive method for inter-board communication is applicable to the following two scenarios:

[0043] Scenario 1, Combining Figure 1 The first and second switching chips belong to different boards;

[0044] Scenario 2, combined Figure 2 The first and second switching chips belong to the same board.

[0045] The keep-alive method for inter-card communication provided in this embodiment of the invention is used to keep-alive the cascaded link between the first chip and the second chip: in scenario 1, it keeps-alive the cascaded link between different boards, while in scenario 2, it keeps-alive the cascaded link between two switching chips within the same board.

[0046] Please refer to Figure 3 , Figure 3 This is a flowchart illustrating a keep-alive method for inter-card communication provided in an embodiment of the present invention. The method includes the following steps:

[0047] S100: Send keep-alive messages from the first switching chip to the second switching chip according to the set sending cycle, and record the sending timestamp at the same time.

[0048] In this embodiment, keep-alive messages are sent periodically, with the initial value of the sending period being a preset default sending period (e.g., 500ms or 800ms). The message interaction during a single keep-alive process is as follows: the processor connected to the first switching chip generates a keep-alive message and sends it to the first switching chip. The first switching chip then sends the keep-alive message through a cascade port connected to the second switching chip. Upon receiving the keep-alive message, the second switching chip sends it to the processor connected to it. The processor connected to the second switching chip then acknowledges and verifies the keep-alive message and sends a keep-alive confirmation message to the second switching chip. The second switching chip then sends the keep-alive confirmation message from the cascade port connected to the first switching chip. If the first switching chip receives the keep-alive confirmation message, it sends it to the processor connected to it. After the processor connected to the first switching chip acknowledges and verifies the keep-alive confirmation message, one keep-alive cycle is complete.

[0049] Optionally, the processor connected to the first switching chip records the transmission timestamp of each keep-alive message and starts a software timer each time it sends a keep-alive message. The duration of the software timer is equal to the current receive waiting period. The initial value of the receive waiting period is a preset default waiting period (e.g., 500ms or 800ms).

[0050] S200. If no keep-alive confirmation message is received from the second switching chip within the set receiving waiting period and the sending period is equal to the default sending period, then the sending period is reset to the product of the default sending period and the set ratio, and the keep-alive message is sent periodically.

[0051] In this embodiment, if no keep-alive confirmation message is received from the second switching chip before the software timer ends, and the sending period is equal to the default sending period, the sending period is reset to the product of the default sending period and a set ratio, and keep-alive messages are sent periodically.

[0052] For example, the set ratio can be 1 / s, and s can be configured according to empirical values ​​and actual application scenarios. For example, s can be 2, 3, 4, etc. This example is only for illustration and is not limited here.

[0053] In this way, if a keep-alive acknowledgment message is not received within the receiving waiting period, the sending period will be shortened. This reduces the interval between sending keep-alive messages, allowing for faster detection and fault switching if a cascaded link has failed, thus enabling rapid keep-alive convergence.

[0054] S300: If a keep-alive confirmation message is received from the second switching chip within the receive waiting period, the receive timestamp is recorded, the time difference between the receive timestamp and the send timestamp is calculated, and the receive waiting period is reset to the time difference if the receive waiting period is longer than the default waiting period.

[0055] In this embodiment, if a keep-alive confirmation message is received from the second switching chip before the software timer ends, the received timestamp is recorded and the time difference between the received timestamp and the sent timestamp is calculated. Then: if the receive waiting period is equal to the default waiting period, the receive waiting period is not updated; if the receive waiting period is greater than the default waiting period, it indicates that the state of the first board may have been unstable (e.g., high CPU utilization or the first switching chip was busy) and the receive waiting period was adjusted. In this case, the receive waiting period is reset to the time difference value so that the receive waiting period is adapted to the current state of the first board. This avoids keep-alive failure due to a fixed waiting period when communication between the two chips is normal but the board state is unstable, as is the case in the prior art.

[0056] The keep-alive method for inter-card communication provided in this invention is applied to a first board in a distributed system. The first board includes a processor and a first switching chip communicatively connected to the processor. A second switching chip of a second board in the distributed system is communicatively connected to the first switching chip. The method is as follows: During the keep-alive process, if the first board does not receive a keep-alive acknowledgment message from the second switching chip within the receive waiting period, the sending period is shortened, enabling rapid keep-alive convergence and timely fault detection. If the first board receives a keep-alive acknowledgment message from the second switching chip within the receive waiting period, the receive waiting period is adaptively reset to the time difference between the transmission and reception of the two messages. This allows keep-alive to flexibly adapt to the current state of the board, avoiding keep-alive failure due to a fixed waiting period when the board state is unstable, as is the case in existing technologies.

[0057] An optional implementation is that, in step S200 above, the following two reasons may cause the keep-alive confirmation message returned by the second switching chip not to be received during the receive waiting period:

[0058] Reason 1: Keep-alive confirmation messages are discarded (either the first switching chip discards them after receiving them or a cascade link failure causes packet loss). For example, packet loss may be caused by PCIe (Direct Memory Access) or DMA (Direct Memory Access) abnormalities.

[0059] Reason 2: The keep-alive confirmation message was not discarded, but arrived with a delay after the receive waiting period. For example, it may be delayed due to environmental reasons (i.e., unstable board status), such as high CPU utilization or busy first switching chip.

[0060] In step S200 above, after resetting the transmission period to the product of the default transmission period and a set ratio, the first board will continue to periodically send keep-alive messages according to the reduced transmission period. Under the two different circumstances described above, the situations that occur during the continued periodic transmission of keep-alive messages will also differ, which will be explained in detail below.

[0061] Please see Figure 4 After step S200 above, the method for keeping the inter-card communication alive may further include the following steps S210 and S220.

[0062] S210. After each keep-alive message is sent, if no keep-alive confirmation message is received from the second switching chip at the end of the corresponding receive waiting period and the keep-alive confirmation message is not received in the Kth consecutive receive waiting period, then keep-alive messages will continue to be sent periodically based on the sending period, where K is a positive integer set according to empirical values.

[0063] S220. If a keep-alive acknowledgment message is not received within the corresponding receive waiting period after sending a keep-alive message for K consecutive transmission cycles, it is determined that a communication failure has occurred between the first switching chip and the second switching chip.

[0064] If the above reason 1 causes the failure to receive the keep-alive acknowledgment message within the receive waiting period, it indicates that there may be a communication failure between the first and second switching chips, or it may just be an occasional packet loss. Then, after step S200 above: execute steps S210 and S220 above in sequence (where K can be 3 or 5), and it can be determined that there is a communication failure between the first and second switching chips, and link switching needs to be performed in time. If the keep-alive acknowledgment message is sent for the first time according to the reduced sending period, and the keep-alive acknowledgment message returned by the second switching chip is received within the corresponding receive waiting period, it indicates that the previous packet loss was just an occasional packet loss. Then, the logic for updating the receive waiting period during this keep-alive process is the same as in step 300 above: while receiving the keep-alive acknowledgment message, the receive timestamp of this time will be recorded. The time difference of this time will be calculated based on the receive timestamp of this time and the sending timestamp of this time. Then, if the receive waiting period is greater than the default waiting period, the receive waiting period will be reset to the time difference of this time and the keep-alive message will continue to be sent periodically based on the sending period.

[0065] If the above reason 2 causes the failure to receive the keep-alive acknowledgment message within the receiving waiting period, then after executing the above step S200, the logic for updating the receiving waiting period during each keep-alive process is the same as that in step 300 above: after each keep-alive message is sent, if the keep-alive acknowledgment message returned by the second switching chip is received within the corresponding receiving waiting period, then while receiving the keep-alive acknowledgment message, the receiving timestamp of this time is recorded, and the time difference of this time is calculated based on the receiving timestamp and the sending timestamp of this time. Then, if the receiving waiting period is greater than the default waiting period, the receiving waiting period is reset to the time difference of this time, and the keep-alive message is sent periodically based on the sending period.

[0066] Furthermore, if the keep-alive acknowledgment message is not received within the receive waiting period due to reason 2 above, then during the execution of step S200, the receive waiting period will be updated according to the logic of step S300 each time the keep-alive process is performed. As the card status stabilizes, the receive waiting period will gradually decrease, at which point the sending period can be restored to the default sending period. Therefore, the keep-alive method for inter-card communication can also include:

[0067] S400. If a keep-alive acknowledgment message is received within the corresponding default waiting period after sending a keep-alive message in N consecutive sending cycles, the sending cycle will be restored to the default sending cycle.

[0068] Where N is a positive integer set according to experience (for example, N can be 10 or 5, etc., which is not limited here). If the keep-alive confirmation message is received within the corresponding default waiting period after sending the keep-alive message for N consecutive sending cycles, then the receiving waiting period is gradually reduced, indicating that the board is becoming stable, and the sending cycle can be directly restored to the default sending cycle.

[0069] The following describes the updating of the sending period and receiving waiting period during the keep-alive process in this invention, with specific examples.

[0070] Assuming a default sending period T TX0 =500ms and default wait period T RX0 =100ms, set ratio is Combination Figure 1 , Figure 1 Processor A in the middle is used to execute the keep-alive method for inter-card communication provided by this invention. Assume the Mth keep-alive process is as follows: during the transmission period T... TX =T TX0 =500ms, receive waiting period T RX =T RX0 Based on a time interval of 100ms, processor A, while sending the Mth keep-alive message to the first switching chip, will also record the timestamp t of the Mth keep-alive message. (M,TX) t0, if at t (M,TX) If processor A receives a keep-alive acknowledgment message from processor B within the next 100ms, then the sending period T... TX and receive waiting period T RX None will be updated; if in t (M,TX) Within the next 100ms, due to high CPU utilization in processor A, processor A does not receive the keep-alive acknowledgment message from processor B. Therefore, processor A will resend the transmission period T. TX Reset to

[0071] After the Mth keep-alive operation, the transmission period T was reduced. TX Based on this, one possible subsequent development is as follows:

[0072] The (M+1)th keep-alive process is as follows: during the transmission period T... TX =250ms, receive waiting period T RX Based on a time interval of 100ms, processor A sends the (M+1)th keep-alive message and records its sending timestamp t. (M+1,TX) If in t (M+1,TX) Within the next 100ms, processor A did not receive a keep-alive confirmation message from processor B, that is, the M+1th keep-alive attempt failed, and processor A then performed the M+2th keep-alive attempt.

[0073] Next, the (M+2)th keep-alive process is as follows: during the transmission period T... TX =250ms, receive waiting period T RX Based on a time interval of 100ms, processor A sends the (M+2)th keep-alive message and records its sending timestamp t. (M+2,TX) If in t (M+2,TX) Within the next 100ms, processor A did not receive a keep-alive confirmation message from processor B, that is, the M+2nd keep-alive attempt failed, and processor A then performed the M+3rd keep-alive attempt.

[0074] If the keep-alive attempt fails again after M+3 attempts, the processor determines that the consecutive keep-alive failure count is 3 (processor A can maintain an initial consecutive keep-alive failure count of 0, and increment the consecutive keep-alive failure count by 1 after each consecutive keep-alive failure). Processor A will then determine that there is a communication failure between the first and second switching chips, and thus perform link switching in a timely manner to avoid cross-card packet loss.

[0075] Thus, the fault detection time is only 750ms, while if the existing technology has a fixed transmission period of 500ms, the fault detection time is 1500ms. Therefore, compared with the existing technology, the present invention significantly shortens the fault detection time by dynamically adjusting the transmission period.

[0076] After the Mth keep-alive operation, the transmission period T was reduced. TX Based on this, another possible development is as follows:

[0077] The (M+1)th keep-alive process is as follows: during the transmission period T... TX =250ms, receive waiting period T RX Based on a time interval of 100ms, processor A sends the (M+1)th keep-alive message and records its sending timestamp t. (M+1,TX) If in t (M+1,TX) Within the next 100ms, processor A received a keep-alive acknowledgment message from processor B and recorded its reception timestamp t. (M+1,RX) Processor A will calculate t (M+1,RX) With t (M+1,TX) The time difference Δt between (M+1) (Assuming Δt is calculated) (M+1) =220ms), then processor A will set the receive wait period T. RX =Δt (M+1) =220ms;

[0078] Next, the (M+2)th keep-alive process is as follows: during the transmission period T... TX =250ms, receive waiting period T RX Based on 220ms, processor A sends the (M+2)th keep-alive message and records its sending timestamp t.(M+2,TX) If in t (M+2,TX) Within the next 220ms, processor A received a keep-alive acknowledgment message from processor B and recorded its reception timestamp t. (M+2,RX) Processor A will calculate t (M+2,RX) With t (M+2,TX) The time difference Δt between (M+2) (Assuming Δt is calculated) (M+2) =200ms), then processor A will set the receive wait period T. RX =Δt (M+2) =200ms;

[0079] Similarly, in the next few keep-alive processes, the time difference and the updated receive waiting period are as shown in the table below:

[0080]

[0081]

[0082] Next, the (M+6)th keep-alive process is as follows: during the transmission period T TX =250ms, receive waiting period T RX Based on a time interval of 120ms, processor A sends the (M+6)th keep-alive message and records its sending timestamp t. (M+6,TX) If in t (M+6,TX) Within the next 120ms, processor A received a keep-alive acknowledgment message from processor B and recorded its reception timestamp t. (M+2,RX) At this point, processor A determines that it has received keep-alive acknowledgment messages for 5 consecutive receive waiting periods (assuming N=5). At this time, processor A will directly reset the sending period T. TX =T TX0 =500ms, then according to the sending period T TX =500ms, receive waiting period T RX =120ms to perform the M+7th keep-alive; in this way, even if the board state is unstable when the communication between the two switching chips is normal, after shortening the transmission period, the receiving waiting period is flexibly adjusted to adapt to the board state, and when the board state tends to be stable, the transmission period is restored to the default transmission period. This avoids the direct judgment of keep-alive failure due to the fixed waiting period, as in the existing technology, which leads to direct fault misjudgment.

[0083] Conversely, if the (M+6)th, (M+7)th, and (M+8)th keep-alive processes all fail, processor A can determine that a communication failure has occurred between the first and second switching chips.

[0084] Therefore, by reducing the transmission period T TXAfter that, if there are 3 consecutive keep-alive failures (assuming N=3), regardless of whether the transmission period T is shortened... TX If the following three keep-alive attempts fail, or if there are three non-adjacent keep-alive attempts that fail, it can be determined that there is a communication failure between the first and second switching chips.

[0085] The above examples are merely illustrations. The embodiments of the present invention do not limit the default sending period, default waiting period, K, N, or the set ratio.

[0086] The card-to-card communication keep-alive method provided by this invention is universal and applicable regardless of whether the switching chip is a BCM (Broadcom Corporation) chip or a CTC (China Telecom Corporation) chip, and regardless of whether the distributed system is a distributed stack or a box-type stack. The card-to-card communication keep-alive method provided by this invention can also be applied to other modules with high requirements for protocol keep-alive, such as OAM (Operations, Administration, and Maintenance) and PPPoE (Point-to-Point Protocol Over Ethernet) scenarios.

[0087] It should be noted that the execution order of each step in the above method embodiments is not limited to that shown in the attached figures, and the execution order of each step shall be subject to the actual application situation.

[0088] In order to perform the corresponding steps in the above method embodiments and various possible implementations, an implementation method of a card-to-card communication keep-alive device is given below.

[0089] Please see Figure 5 , Figure 5 A schematic diagram of the inter-card communication keep-alive device 200 provided in an embodiment of the present invention is shown. This inter-card communication keep-alive device 200 is applied to a first board in a distributed system. The first board includes a processor and a first switching chip communicatively connected to the processor. A second switching chip of a second board in the distributed system is communicatively connected to the first switching chip.

[0090] The keep-alive device 200 for inter-card communication includes: a transmitting module 210 and an adjusting module 220, wherein:

[0091] The sending module 210 is used to send keep-alive messages from the first switching chip to the second switching chip according to the set sending period, and at the same time record the sending timestamp;

[0092] The adjustment module 220 is used to reset the sending period to the product of the default sending period and a set ratio if no keep-alive confirmation message is received from the second switching chip within the set receiving waiting period and the sending period is equal to the default sending period. Then the sending module 210 is used to continue to periodically send keep-alive messages.

[0093] The adjustment module 230 is also used to record the receiving timestamp and calculate the time difference between the receiving timestamp and the sending timestamp if a keep-alive confirmation message is received from the second switching chip within the receiving waiting period, and to reset the receiving waiting period to the time difference if the receiving waiting period is greater than the default waiting period.

[0094] Optionally, after the adjustment module 220 resets and reduces the transmission period to a set ratio of the default transmission period, the transmission module 210 can be used to: after each transmission of a keep-alive message, if no keep-alive confirmation message is received from the second switching chip at the end of the corresponding receive waiting period and the keep-alive confirmation message is not received in the Kth consecutive receive waiting period, then continue to periodically transmit keep-alive messages based on the transmission period, where K is a positive integer set according to empirical values.

[0095] Optionally, after the adjustment module 220 resets and reduces the transmission period to a set ratio of the default transmission period, the transmission module 210 can be used to determine that a communication failure has occurred between the first switching chip and the second switching chip if no keep-alive confirmation message is received within K consecutive receive waiting periods.

[0096] Optionally, after resetting the receive waiting period to the time difference value, the adjustment module 220 can also be used to restore the sending period to the default sending period if a keep-alive acknowledgment message is received within the corresponding default waiting period after sending a keep-alive message for N consecutive sending periods; N is a positive integer set according to empirical values.

[0097] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the card-to-card communication keep-alive device 200 described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0098] This invention also provides a board including a processor, a memory, a switching chip, and a bus, wherein the processor, memory, and switching chip are interconnected via the bus. The memory can be used to store software programs, such as the software program corresponding to the card-to-card communication keep-alive device 200 provided in this invention embodiment. The processor executes various functional applications and data processing by running the software program stored in the memory to implement the card-to-card communication keep-alive method provided in this invention embodiment.

[0099] The memory can be, but is not limited to: RAM (Random Access Memory), ROM (Read Only Memory), FLASH (Flash Memory), PROM (Programmable Read-Only Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electric Erasable Programmable Read-Only Memory), etc.

[0100] A processor can be an integrated circuit chip with signal processing capabilities. This processor can be a general-purpose processor, including: CPU (Central Processing Unit), NP (Network Processor), etc.; it can also be: DSP (Digital Signal Processor), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0101] It is understandable that the board may include more or fewer components, or have different configurations, and each component may be implemented in hardware, software or a combination thereof.

[0102] This invention also provides a network device, which may include the aforementioned board.

[0103] This invention also provides a computer-readable storage medium storing a computer program. When executed by a processor, this computer program implements the card-to-card communication keep-alive method disclosed in the above embodiments. The computer-readable storage medium can be, but is not limited to, various media capable of storing program code, such as a USB flash drive, portable hard drive, ROM, RAM, PROM, EPROM, EEPROM, FLASH disk, or optical disk.

[0104] In summary, this invention provides a keep-alive method and related apparatus for inter-card communication. The method is applied to a first board in a distributed system, which includes a processor and a first switching chip communicatively connected to the processor. A second switching chip on a second board in the distributed system is communicatively connected to the first switching chip. In this method: a keep-alive message is sent from the first switching chip to the second switching chip according to a set sending period, and a sending timestamp is recorded simultaneously; if no keep-alive acknowledgment message is received from the second switching chip within a set receiving waiting period, and the sending period is equal to the default sending period, the sending period is reset to the product of the default sending period and a set ratio, and keep-alive messages are sent periodically; if a keep-alive acknowledgment message is received from the second switching chip within the receiving waiting period, the receiving timestamp is recorded, and the time difference between the receiving timestamp and the sending timestamp is calculated. If the receiving waiting period is greater than the default waiting period, the receiving waiting period is reset to the time difference. Thus, during the keep-alive process, if the first board does not receive the keep-alive acknowledgment message returned by the second switching chip within the receive waiting period, the sending period will be shortened, enabling the keep-alive to converge quickly and detect faults in a timely manner. If the first board receives the keep-alive acknowledgment message returned by the second switching chip within the receive waiting period, the receive waiting period will be adaptively reset to the time difference between the sending and receiving of the two messages, allowing the keep-alive to flexibly adapt to the current state of the board, avoiding keep-alive failure due to a fixed waiting period when communication between the two chips is normal but the board state is unstable, as is the case in the prior art.

[0105] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A keep-alive method for inter-card communication, characterized in that, A first board applied in a distributed system; the first board includes a processor and a first switching chip communicatively connected to the processor, wherein a second switching chip of a second board in the distributed system is communicatively connected to the first switching chip; the method includes: According to the set sending cycle, the first switching chip sends a keep-alive message to the second switching chip, and records the sending timestamp at the same time; If no keep-alive confirmation message is received from the second switching chip within the set receiving waiting period and the sending period is equal to the default sending period, then the sending period is reset to the product of the default sending period and a set ratio, and the keep-alive message is sent periodically. If a keep-alive acknowledgment message is received from the second switching chip within the receive waiting period, the receive timestamp is recorded, and the time difference between the receive timestamp and the send timestamp is calculated. If the receive waiting period is longer than the default waiting period, the receive waiting period is reset to the time difference.

2. The method according to claim 1, characterized in that, After the step of resetting the transmission period to the product of the default transmission period and a set ratio, and then continuing to periodically transmit the keep-alive message, the method further includes: After each send of the keep-alive message, if no keep-alive confirmation message is received from the second switching chip at the end of the corresponding receive waiting period and the keep-alive confirmation message is not received in the Kth consecutive receive waiting period, then the keep-alive message will continue to be sent periodically based on the sending period, where K is a positive integer set according to an empirical value.

3. The method according to claim 2, characterized in that, After the step of resetting the transmission period to the product of the default transmission period and a set ratio, and then continuing to periodically transmit the keep-alive message, the method further includes: If no keep-alive confirmation message is received within K consecutive receive waiting periods, it is determined that a communication failure has occurred between the first switching chip and the second switching chip.

4. The method according to claim 1, characterized in that, After the step of resetting the reception waiting period to the time difference value, the method further includes: If, after sending the keep-alive message, the keep-alive confirmation message is received within the corresponding default waiting period for N consecutive sending cycles, the sending cycle is restored to the default sending cycle; where N is a positive integer set based on empirical values.

5. A keep-alive device for inter-card communication, characterized in that, A first board used in a distributed system; the first board includes a processor and a first switching chip communicatively connected to the processor, wherein a second switching chip of a second board in the distributed system is communicatively connected to the first switching chip; the device includes: The sending module is used to send keep-alive messages from the first switching chip to the second switching chip according to a set sending period, and at the same time record the sending timestamp; The adjustment module is used to reset the sending period to the product of the default sending period and a set ratio if no keep-alive confirmation message is received from the second switching chip within the set receiving waiting period and the sending period is equal to the default sending period; the sending module is used to continue to periodically send the keep-alive message. The adjustment module is also configured to, if a keep-alive confirmation message is received from the second switching chip within the receiving waiting period, record the receiving timestamp, calculate the time difference between the receiving timestamp and the sending timestamp, and reset the receiving waiting period to the time difference if the receiving waiting period is greater than the default waiting period.

6. The apparatus according to claim 5, characterized in that, The adjustment module is used to reset the transmission period to the product of the default transmission period and a set ratio, and the transmission module is used to: After each send of the keep-alive message, if no keep-alive confirmation message is received from the second switching chip at the end of the corresponding receive waiting period and the keep-alive confirmation message is not received in the Kth consecutive receive waiting period, then the keep-alive message will continue to be sent periodically based on the sending period, where K is a positive integer set according to an empirical value.

7. The apparatus according to claim 6, characterized in that, The adjustment module is used to reset the transmission period to the product of the default transmission period and a set ratio, and the transmission module is used to: If no keep-alive confirmation message is received within K consecutive receive waiting periods, it is determined that a communication failure has occurred between the first switching chip and the second switching chip.

8. A circuit board, characterized in that, include: A memory and a processor, wherein the memory stores a software program, and the processor is configured to execute the software program to implement the keep-alive method for inter-card communication as described in any one of claims 1-4.

9. A network device, characterized in that, Includes the board as described in claim 8.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the keep-alive method for inter-card communication according to any one of claims 1-4.