Link keep-alive state determination method and apparatus, device, and storage medium

By controlling the target network card to read memory values ​​in kernel mode, the problem of difficulty in detecting RoCE link anomalies under Ethernet protocol is solved, thus improving the availability and reliability of the device.

CN119996490BActive Publication Date: 2025-11-07INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510386486.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-28
Publication Date
2025-11-07
Estimated Expiration
2045-03-28

AI Technical Summary

Technical Problem

Under the Ethernet protocol, RoCE links are difficult to detect quickly when problems occur, leading to a decrease in device availability and reliability.

Method used

By controlling the target network card to read memory values ​​according to keep-alive parameters and preset memory address information in kernel mode, the keep-alive status of the link is determined, reducing the interaction process and improving accuracy.

Benefits of technology

It enables rapid detection of link keep-alive status, improving device availability and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119996490B_ABST
    Figure CN119996490B_ABST
Patent Text Reader

Abstract

The application provides a link keep-alive state determination method and device, equipment and storage medium, which can be applied to the technical field of communication connection. The method comprises the following steps: determining a link keep-alive mechanism between a user state in a first device and a user state in a second device according to keep-alive information of a first target network card in the first device and keep-alive information of a second target network card in the second device; in the case that the link keep-alive mechanism is a kernel state keep-alive mechanism, based on the kernel state in the first device: controlling the first target network card to read memory values of the first target network card from a preset memory according to the keep-alive parameters of the first target network card and address information of the preset memory, and determining a link keep-alive state between the user state in the first device and the user state in the second device according to the read memory values, wherein the memory values of the first target network card in the preset memory are set by the second target network card according to a first atomic operation request from the first target network card.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of communication connection, and in particular to a link keep-alive state determination method and device, equipment and a storage medium. BACKGROUND

[0002] With the development of Internet, cloud computing, Internet of Things, mobile Internet and other technologies, data is growing explosively, which poses new challenges to the transmission efficiency of traditional data transmission networks. In the traditional network communication mode, a large amount of Central Processing Unit (CPU) resources are occupied in the data transmission process, resulting in high data transmission delay. To solve this problem, Remote Direct Memory Access (RDMA) technology emerges as the times require, which can significantly reduce the delay of data transmission and improve the efficiency of data processing.

[0003] RDMA over Converged Ethernet (RoCE) is an Ethernet-based RDMA technology standard, which enables RDMA to run not only on InfiniBand networks, but also on Ethernet networks. However, the Ethernet protocol is prone to loss and loss, which makes it difficult to quickly perceive RoCE link abnormalities after the RoCE link has problems. SUMMARY

[0004] In view of the above problems, the present application provides a link keep-alive state determination method, device, equipment and storage medium.

[0005] According to a first aspect of the present application, a link keep-alive state determination method is provided, comprising: determining a link keep-alive mechanism between a user state in a first device and a user state in a second device according to keep-alive information of a first target network card in the first device and keep-alive information of a second target network card in the second device; in the case that the link keep-alive mechanism is a kernel state keep-alive mechanism, based on the kernel state in the first device: controlling the first target network card to read the memory value of the first target network card from a preset memory according to the keep-alive parameters of the first target network card and the address information of the preset memory, and determining the link keep-alive state between the user state in the first device and the user state in the second device according to the read memory value, wherein the memory value of the first target network card in the preset memory is set by the second target network card according to a first atomic operation request from the first target network card.

[0006] The second aspect of the present application provides a link keep-alive state determination apparatus, comprising: a determination module configured to determine a link keep-alive mechanism between a user state in a first device and a user state in a second device according to keep-alive information of a first target network card in the first device and keep-alive information of a second target network card in the second device; and a control module configured to, when the link keep-alive mechanism is a kernel state keep-alive mechanism, control, based on a kernel state in the first device, the first target network card to read memory values of the first target network card from a preset memory according to keep-alive parameters of the first target network card and address information of the preset memory, and determine a link keep-alive state between the user state in the first device and the user state in the second device according to the read memory values, wherein the memory values of the first target network card in the preset memory are set by the second target network card according to a first atomic request from the first target network card.

[0007] The third aspect of the present application provides an electronic device, comprising: one or more processors; and a memory configured to store one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement steps of the method.

[0008] The fourth aspect of the present application further provides a computer-readable storage medium having stored thereon a computer program or instructions, wherein the computer program or instructions, when executed by a processor, implement steps of the method.

[0009] The fifth aspect of the present application further provides a computer program product comprising a computer program or instructions, wherein the computer program or instructions, when executed by a processor, implement steps of the method.

[0010] According to the link keep-alive state determination method, apparatus, device and storage medium provided in the application, in the case that a link is established between the user state in the first device and the user state in the second device, the link keep-alive mechanism between the user states is determined according to the keep-alive information of the first target network card and the second target network card, so that the selection of different link keep-alive mechanisms is realized; in the case that the link keep-alive mechanism is the kernel state keep-alive mechanism, the kernel state in the first device controls the first target network card to read the memory value of the first target network card from the preset memory according to the address information of the preset memory and the keep-alive parameter of the first target network card. Since the memory value of the first target network card in the preset memory is set by the second target network card according to the first atomic operation request from the first target network card, the link keep-alive state between the user state in the first device and the user state in the second device can be determined based on the memory value of the first target network card read from the preset memory. In addition, since the first target network card reads the memory value of the first target network card from the preset memory, the interaction process in the link keep-alive mechanism is reduced, and the accuracy of the link keep-alive mechanism is further improved. The reading of the memory value in the preset memory by the kernel state control of the first target network card enables the link keep-alive state between the user states to be quickly perceived, so as to achieve the purpose of improving the availability and reliability of the device. BRIEF DESCRIPTION OF DRAWINGS

[0011] The above content and other purposes, features and advantages of the application will be more clearly understood through the following description of the embodiments of the application with reference to the accompanying drawings, in which:

[0012] Figure 1 An application scenario diagram of the link keep-alive state determination method according to an embodiment of the application is schematically shown;

[0013] Figure 2 A flowchart of the link keep-alive state determination method according to an embodiment of the application is schematically shown;

[0014] Figure 3 A flowchart of generating a network card configuration file according to an embodiment of the application is schematically shown;

[0015] Figure 4 A keep-alive process diagram of executing a user state keep-alive mechanism according to an embodiment of the application is schematically shown;

[0016] Figure 5 A structural block diagram of the link keep-alive state determination apparatus according to an embodiment of the application is schematically shown; and

[0017] Figure 6 A block diagram of an electronic device suitable for implementing the link keep-alive state determination method according to an embodiment of the application is schematically shown. DETAILED DESCRIPTION

[0018] Embodiments of the present application will be described herein below with reference to the accompanying drawings. It should be understood, however, that the description is merely exemplary and is not intended to limit the scope of the present application. In the following detailed description, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, that one or more embodiments can be practiced without these specific details. In other instances, well-known structures and techniques have not been described in detail in order to avoid unnecessarily obscuring the concepts of the present application.

[0019] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the present application. As used herein, the term "includes" and tautological expressions thereof, such as "including," "includes," "include," "contains," "containing," and so on, mean the term "comprises," unless otherwise noted.

[0020] All terms used herein, including technical and scientific terms, have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of the specification, and should not be interpreted in an idealized or overly formal manner.

[0021] In the case of using expressions similar to "at least one of A, B, and C, etc.", in general, it should be interpreted as having the meaning of "one or more of the items from the group consisting of A, B, and C" unless otherwise noted. For example, "a system having at least one of A, B, and C" should include but not be limited to a system having A alone, a system having B alone, a system having C alone, a system having both A and B, a system having both A and C, a system having both B and C, and / or a system having A, B, and C, etc.

[0022] In the technical solutions of the present application, the user information (including but not limited to user personal information, user image information, user equipment information, such as location information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved are information and data authorized by the user or authorized by all parties, and the collection, storage, use, processing, transmission, provision, application, and application of related data comply with relevant laws, regulations, and standards, take necessary security measures, do not violate public order and good customs, and provide corresponding operation portal for user selection authorization or refusal.

[0023] RDMA is an innovative network communication technology that enables computers to directly access the memory of remote computers without the need for tedious data copying between local and remote computers, thereby significantly reducing the delay of data transmission and improving the efficiency of data processing. Therefore, RDMA plays a crucial role in network communication, especially in fields with extremely high requirements for network performance, such as high-performance computing, data centers, cloud computing, etc.

[0024] RoCE is an Ethernet-based RDMA technology standard, so that RDMA can also run on Ethernet. However, the Ethernet protocol has the problem of being vulnerable and easy to lose, which makes it difficult to quickly perceive the RoCE link exception after the RoCE link problem occurs.

[0025] To this end, an embodiment of the present application provides a link keep-alive state determination method to quickly perceive the keep-alive state of the link.

[0026] Figure 1 An application scenario diagram of the link keep-alive state determination method according to an embodiment of the present application is schematically shown.

[0027] As shown in Figure 1 , the application scenario 100 according to this embodiment can include a first device 101, a second device 102 and a network 103. The network 103 is a medium for providing a communication link between the first device 101 and the second device 102. The network 103 can include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0028] The first device 101 interacts with the second device 102 through the network 103 to receive or send messages, etc. The first device 101 and the second device 102 can be servers providing various services.

[0029] For example, the link keep-alive mechanism between the user state in the first device 101 and the user state in the second device 102 can be determined according to the keep-alive information of the first target network card in the first device 101 and the keep-alive information of the second target network card in the second device 102, and in the case that the link keep-alive mechanism is the kernel state keep-alive mechanism, the first target network card is controlled to read the memory value of the first target network card from the preset memory according to the keep-alive parameters of the first target network card and the address information of the preset memory based on the kernel state in the first device 101, so that the link keep-alive state between the user state in the first device 101 and the user state in the second device 102 can be determined according to the read memory value, wherein the memory value of the first target network card in the preset memory is set by the second target network card according to the first atomic operation request from the first target network card.

[0030] It should be noted that the link keep-alive state determination method provided by the embodiments of the present application can generally be executed by the first device 101. Correspondingly, the link keep-alive state determination apparatus provided by the embodiments of the present application can generally be provided in the first device 101.

[0031] It should be understood that Figure 1 the number of the first device, the second device and the network in is only illustrative. According to the implementation needs, there can be any number of first devices, second devices and networks.

[0032] The following will be based on Figure 1 The described scenario, by Figures 2-4 The link keep-alive state determination method of the embodiments of the present application is described in detail.

[0033] Figure 2 The flowchart of the link keep-alive state determination method according to the embodiments of the present application is schematically shown.

[0034] As Figure 2 shown, the method 200 includes operation S210 and operation S220.

[0035] After the user state in the first device and the user state in the second device establish a link, in order to quickly and accurately perceive the link keep-alive state between the user states, the first device is applied to perform operation S210 and operation S220. Similarly, the second device also performs similar steps as the first device to perceive the link keep-alive state between the user states from the second device end.

[0036] Among them, the first device and the second device can be servers.

[0037] In operation S210, according to the keep-alive information of the first target network card in the first device and the keep-alive information of the second target network card in the second device, the link keep-alive mechanism between the user state in the first device and the user state in the second device is determined.

[0038] According to the embodiments of the present application, after the first target network card in the first device and the second target network card in the second device establish a connection, the transmission of keep-alive information between the first target network card and the second target network card will be carried out, that is, the first target network card can send the keep-alive information of the first target network card to the second target network card, and similarly, the second target network card will also send the keep-alive information of the second target network card to the first target network card.

[0039] According to the embodiments of the present application, in the first device, the link keep-alive mechanism between the user state in the first device and the user state in the second device can be determined according to the keep-alive information of the first target network card and the received keep-alive information from the second target network card, so as to execute the corresponding link keep-alive mechanism subsequently.

[0040] Among them, the first target network card and the second target network card can be RoCE network cards.

[0041] According to the embodiments of the present application, the keep-alive information of the first target network card in the first device can be stored in the pre-configured network card configuration file in the first device. The keep-alive information of the second target network card in the second device can also be stored in the pre-configured network card configuration file in the second device.

[0042] Thus, after the first target network card and the second target network card establish a connection, the keep-alive information in the respective network card configuration files is read, and the read keep-alive information is sent to the corresponding network card, that is, the first target network card sends the keep-alive information of the first target network card to the second target network card, and the second target network card sends the keep-alive information of the second target network card to the first target network card.

[0043] Figure 3 A flowchart of generating a network card configuration file according to an embodiment of the present application is schematically shown.

[0044] As shown in Figure 3 The method 300 includes operations S310-S350.

[0045] The first device and the second device can respectively perform operations S310-S350 to generate respective network card configuration files to read keep-alive information of a network card from the network card configuration file, for determining a link keep-alive mechanism between a user mode in the first device and a user mode in the second device.

[0046] In operation S310, a configuration file is obtained.

[0047] In operation S320, whether there is a target network card on a target slot recorded in the configuration file is detected.

[0048] According to an embodiment of the present application, operation S330 is performed in the case where there is a target network card on the target slot, and operation S340 is performed in the case where there is no target network card on the target slot.

[0049] In operation S330, device information of the target network card on the target slot is recorded in the configuration file.

[0050] In operation S340, device information of the remaining network cards on the target slot is recorded in the configuration file, and device information of the network cards on the remaining slots is recorded in the configuration file.

[0051] In operation S350, a network card configuration file is generated.

[0052] According to an embodiment of the present application, slots identified as supporting high-precision keep-alive are inconsistent in different hardware platforms, and therefore, a configuration file about precision keep-alive in the hardware platform is obtained. The configuration file records which slots are identified as supporting high-precision keep-alive and which slots are identified as not supporting high-precision keep-alive.

[0053] The hardware platform can include any one of the first device and the second device in operation S210 described above; and the slot can refer to a Peripheral Component Interconnect Express (PCIE) address in the hardware platform.

[0054] According to an embodiment of the present application, the target slot is a slot recorded in the configuration file and identified as supporting high-precision keep-alive, the remaining slots are slots recorded in the configuration file and identified as not supporting high-precision keep-alive, and the target network card is an RoCE network card, and the remaining network cards can be network cards other than RoCE network cards.

[0055] Based on the configuration file, it is detected whether the target network card is on the target slot recorded in the configuration file, for example, whether the target network card is inserted into the target slot.

[0056] In the case that the target network card is on the target slot, the target network card supports high-precision keep-alive, that is, supports precise keep-alive; in the case that the target network card is on the remaining slots, the target network card does not support high-precision keep-alive; in the case that the remaining network cards are on the target slot, high-precision keep-alive is also not supported. Therefore, only when the target network card is on the target slot, the target network card can support high-precision keep-alive.

[0057] According to an embodiment of the present application, the device information can include a slot number and keep-alive information, and the keep-alive information can represent whether the network card supports high-precision keep-alive. The device information of the network cards on the target slot and the remaining slots is recorded in the configuration file to generate a network card configuration file.

[0058] In the case that the user state in the first device establishes a link with the user state in the second device, the network card configuration file is read to identify whether the network cards loaded by the first device and the second device are target network cards, and in the case that the network cards loaded by the first device and the second device are both target network cards, the keep-alive information of the first target network card and the second target network card is determined from the network card configuration file. Wherein, the keep-alive parameters of the network cards in the network card configuration file can be set as needed.

[0059] In operation S220, in the case that the link keep-alive mechanism is a kernel state keep-alive mechanism, based on the kernel state in the first device: the first target network card reads the memory value of the first target network card from the preset memory according to the keep-alive parameters of the first target network card and the address information of the preset memory, and determines the link keep-alive state between the user state in the first device and the user state in the second device according to the read memory value.

[0060] Wherein, the memory value of the first target network card in the preset memory is set by the second target network card according to the first atomic operation request from the first target network card.

[0061] According to an embodiment of the present application, in a case where the link keep-alive mechanism is determined to be the kernel mode keep-alive mechanism based on the keep-alive information of the first target network card and the second target network card respectively, the kernel mode in the first device controls the first target network card to read the memory value of the first target network card from the preset memory according to the keep-alive parameter of the first target network card and the address information of the preset memory, so that the link keep-alive state between the user mode in the first device and the user mode in the second device can be determined according to the read memory value.

[0062] According to an embodiment of the present application, in a case where the link keep-alive mechanism is determined to be the kernel mode keep-alive mechanism based on the keep-alive information of the first target network card and the second target network card respectively, the kernel mode in the first device controls the first target network card to read the memory value of the first target network card from the preset memory according to the keep-alive parameter of the first target network card and the address information of the preset memory, so that the link keep-alive state between the user mode in the first device and the user mode in the second device can be determined according to the read memory value.

[0063] According to an embodiment of the present application, in a case where the link keep-alive mechanism is determined to be the kernel mode keep-alive mechanism based on the keep-alive information of the first target network card and the second target network card respectively, the kernel mode in the first device controls the first target network card to read the memory value of the first target network card from the preset memory according to the keep-alive parameter of the first target network card and the address information of the preset memory, so that the link keep-alive state between the user mode in the first device and the user mode in the second device can be determined according to the read memory value.

[0064] According to an embodiment of the present application, the control of the first target network card to read the memory value of the first target network card from the preset memory according to the keep-alive parameter of the first target network card and the address information of the preset memory, and the determination of the link keep-alive state between the user mode in the first device and the user mode in the second device according to the read memory value, include: controlling the first target network card to repeatedly read the memory value of the first target network card at a first time interval until the number of repeated readings is equal to a retry number or the read memory value is consistent with an expected value; in a case where the read memory value is consistent with the expected value and the number of repeated readings is less than or equal to the retry number, determining that the link keep-alive state is that the link connection between the user mode in the first device and the user mode in the second device is normal.

[0065] According to an embodiment of the present application, the kernel in the first device controls the first target network card to periodically read the memory value of the first target network card in the preset memory at the first time interval.

[0066] When the link connection between the user state in the first device and the user state in the second device is normal, the first target network card reads the memory value of the first target network card from the preset memory at the first time interval should be consistent with the expected value. When the memory value read by the first target network card is inconsistent with the expected value, the kernel controls the first target network card to repeatedly read the memory value of the first target network card in the preset memory at the first time interval.

[0067] When the read memory value is consistent with the expected value and the number of repeated readings is less than or equal to the retry number, it is determined that the link keep-alive state is that the link connection between the user state in the first device and the user state in the second device is normal, that is, within the retry number, the memory value of the repeated reading is consistent with the expected value, and it is determined that the link connection between the user state in the first device and the user state in the second device is normal.

[0068] According to an embodiment of the present application, only by reading the memory value of the first target network card in the preset memory, and when the number of repeated readings is less than or equal to the retry number, the read memory value is consistent with the expected value, the link connection between the user states can be quickly determined to be normal.

[0069] According to an embodiment of the present application, the link keep-alive state determination method further comprises: when the read memory value is inconsistent with the expected value and the number of repeated readings is equal to the retry number, determining that the link keep-alive state is that the link connection between the user state in the first device and the user state in the second device is abnormal.

[0070] According to an embodiment of the present application, when the number of repeated readings is equal to the retry number, if the read memory value is still inconsistent with the expected value, the link connection between the user state in the first device and the user state in the second device is abnormal, so that the link between the user state in the first device and the user state in the second device can be controlled to be disconnected.

[0071] According to an embodiment of the present application, if the memory value is still inconsistent with the expected value within the retry number, the link keep-alive state between the user states can be quickly perceived, and it is specifically determined that the link connection between the user states is abnormal.

[0072] According to an embodiment of the present application, the link keep-alive state determination method further comprises: in response to a second atomic operation request from the second target network card, controlling the first target network card to compare a memory value of the second target network card read from a preset area of the second target network card with a first comparison value in the second atomic operation request; and in a case where the read memory value of the second target network card is consistent with the first comparison value, controlling the first target network card to update the memory value of the second target network card with a first update value in the second atomic operation request.

[0073] According to an embodiment of the present application, in a case where a link is established between the user state in the first device and the user state in the second device, the first target network card and the second target network card perform interaction of address information of preset memories, i.e., the first target network card sends address information of preset memories of the first target network card to the second target network card, and the second target network card sends address information of preset memories of the second target network card to the first target network card.

[0074] According to an embodiment of the present application, the second target network card periodically sends a second atomic operation request to the first target network card at a first time interval. In a case where the first target network card receives the second atomic operation request from the second target network card, the kernel state in the first device controls the first target network card to read a memory value of the second target network card from a preset memory of the second target network card according to address information of the preset memory of the second target network card. The read memory value of the second target network card is compared with a first comparison value carried in the second atomic operation request to determine whether the last atomic operation of the first target network card is successfully executed. The first comparison value represents an updated memory value of the second target network card in a case where the last atomic operation of the first target network card is successfully executed.

[0075] According to an embodiment of the present application, in a case where the read memory value of the second target network card is consistent with the first comparison value, the first target network card is controlled to update the memory value of the second target network card with a first update value carried in the second atomic operation request.

[0076] For example, in a case where the last atomic operation of the first target network card is successfully executed, the memory value of the second target network card in the preset memory of the second target network card is updated to 3. In the process of the current atomic operation of the first target network card, the first comparison value carried in the second atomic operation request is 3. If the memory value of the second target network card read by the first target network card from the preset memory of the second target network card is 3, i.e., the read memory value of the second target network card is consistent with the first comparison value carried in the second atomic operation request, the memory value of the second target network card can be updated with the first update value carried in the second atomic operation request.

[0077] According to the embodiment of the present application, in the case that the second target network card sends the second atomic operation request, the first target network card is controlled to compare the read memory value of the second target network card with the first comparison value in the second atomic operation request to see if they are consistent, and in the case that the read memory value of the second target network card is consistent with the first comparison value, the first update value is used to update the memory value of the second target network card in the preset memory of the second target network card, which is beneficial to the subsequent second target network card to read the memory value in the preset memory and judge the link keep-alive state between the user state in the first device and the user state in the second device based on whether the read memory value is consistent with the expected value.

[0078] According to the embodiment of the present application, the above-mentioned link keep-alive state determination method further comprises: controlling the first target network card to periodically send the first atomic operation request to the second target network card at a first time interval, so that the second target network card updates the memory value of the first target network card according to the second update value and the second comparison value in the first atomic operation request.

[0079] According to the embodiment of the present application, the first target network card can also periodically send the first atomic operation request to the second target network card at a first time interval, so that the memory value in the preset memory of the first target network card is updated according to the second update value and the second comparison value carried in the first atomic operation request at the second device end.

[0080] According to the embodiment of the present application, the first target network card can also periodically send the first atomic operation request to the second target network card at a first time interval, so that the memory value in the preset memory of the first target network card is updated according to the second update value and the second comparison value carried in the first atomic operation request at the second device end.

[0081] The expected value for comparison with the read memory value of the first target network card can represent the memory value of the first target network card updated in the preset memory by the second target network card last time when performing atomic operation.

[0082] For example, in the case that the link connection between the user state in the first device and the user state in the second device is normal, the memory value of the first target network card updated in the preset memory by the second target network card performing atomic operation is 2. On this basis, the expected value is 2, and if the memory value in the preset memory read by the first target network card is 2, the read memory value is consistent with the expected value, indicating that the link connection between the user state in the first device and the user state in the second device is normal.

[0083] Since the kernel state control performs atomic operation, the precision of the first time interval in the kernel state can be controlled in millisecond, microsecond, nanosecond, so as to avoid additional CPU overhead, and the first time interval can be controlled in millisecond level.

[0084] According to an embodiment of the present application, the link keep-alive mechanism between the user state in the first device and the user state in the second device is determined according to the keep-alive information of the first target network card in the first device and the keep-alive information of the second target network card in the second device, including: in the case that the keep-alive information of the first target network card represents that the first target network card supports accurate keep-alive and the keep-alive information of the second target network card represents that the second target network card supports accurate keep-alive, determining that the link keep-alive mechanism between the user state in the first device and the user state in the second device is the kernel state keep-alive mechanism; in the case that the keep-alive information of the first target network card represents that the first target network card does not support accurate keep-alive and / or the keep-alive information of the second target network card represents that the second target network card does not support accurate keep-alive, determining that the link keep-alive mechanism between the user state in the first device and the user state in the second device is the user state keep-alive mechanism.

[0085] The link keep-alive mechanism can include the kernel state keep-alive mechanism and the user state keep-alive mechanism.

[0086] According to an embodiment of the present application, in the case that the first target network card and the second target network card establish a connection, in the case that the keep-alive information of the first target network card represents that the first target network card supports accurate keep-alive and the keep-alive information of the second target network card represents that the second target network card supports accurate keep-alive, it can be determined that the link keep-alive mechanism between the user state in the first device and the user state in the second device is the kernel state keep-alive mechanism.

[0087] According to an embodiment of the present application, in the case that the keep-alive information of the first target network card represents that the first target network card does not support accurate keep-alive and / or the keep-alive information of the second target network card represents that the second target network card does not support accurate keep-alive, that is, at least one of the keep-alive information of the first target network card and the keep-alive information of the second target network card represents that accurate keep-alive is not supported, it can be determined that the link keep-alive mechanism between the user state in the first device and the user state in the second device is the user state keep-alive mechanism.

[0088] According to an embodiment of the present application, based on the respective keep-alive information of the first target network card and the second target network card, it can be determined whether to execute the kernel state keep-alive mechanism or the user state keep-alive mechanism, which realizes the compatibility of the two link keep-alive mechanisms, and realizes the multiplexing of the network cards.

[0089] According to an embodiment of the present application, in the case that the link keep-alive mechanism is the user mode keep-alive mechanism, the above link keep-alive state determination method further comprises: controlling the first target network card to periodically send a keep-alive request to the second target network card at a second time interval; in the case that the first target network card does not receive a keep-alive response from the second target network card within a preset time period, controlling the link between the user mode in the first device and the user mode in the second device to be disconnected.

[0090] According to an embodiment of the present application, in the case that the link keep-alive mechanism is the user mode keep-alive mechanism, the first target network card is controlled to periodically send a keep-alive request to the second target network card at a second time interval, and in the case that the connection between the user mode in the first device and the user mode in the second device is normal, the first target network card should receive a keep-alive response from the second target network card within a preset time period. The preset time period is a preset multiple of the second time interval.

[0091] According to an embodiment of the present application, in the case that the first target network card does not receive a keep-alive response from the second target network card within a preset time period, it can be judged that the second target network card is timed out, i.e., the link connection between the user mode in the first device and the user mode in the second device is abnormal, and the link between the user mode in the first device and the user mode in the second device can be controlled to be disconnected.

[0092] Figure 4 A keep-alive process diagram of performing a user mode keep-alive mechanism according to an embodiment of the present application is schematically shown.

[0093] As shown in Figure 4 , for the user mode keep-alive mechanism, using a Remote Direct Memory Access Connection Manager (RDMA CM) protocol, the first device (initiator end) 401 initiates a link request to the second device (target end) 402, and the second device 402 returns a link response to create a RoCE link between the user mode in the first device and the user mode in the second device.

[0094] After the link is created, in the case that the connection between the user mode in the first device and the user mode in the second device is normal, the first target network card in the first device periodically sends a keep-alive request (keepalive command) to the second target network card at a second time interval, and the second target network card in the second device responds to the received keep-alive request and sends a keep-alive response to the first target network card.

[0095] Similarly, the second device can also perform the user mode keep-alive mechanism, i.e., perform similar operations as the first device to judge whether the link connection between the user mode in the first device and the user mode in the second device is abnormal at the second device end.

[0096] According to the embodiment of the present application, in the case that the link keep-alive mechanism is the user mode keep-alive mechanism, the first target network card judges whether the connection between the user mode in the first device and the user mode in the second device is abnormal in time by sending a keep-alive request and receiving a keep-alive response.

[0097] Based on the above, the link keep-alive state determination method of the present application pre-scans the RoCE network card at a specific position through the PCIE protocol to generate a network card configuration file recording the keep-alive information of the network card, so as to determine the link keep-alive mechanism based on the keep-alive information of the network card, that is, to determine whether the user mode keep-alive mechanism or the kernel mode keep-alive mechanism is used, and to improve the second-level keep-alive mechanism, so that the link keep-alive state of both ends can be quickly perceived, so as to achieve the purpose of improving the availability and reliability of the device.

[0098] Based on the above link keep-alive state determination method, the present application further provides a link keep-alive state determination device. The following will be described in detail Figure 5 with reference to the device.

[0099] Figure 5 The structure block diagram of the link keep-alive state determination device according to the embodiment of the present application is schematically shown.

[0100] As Figure 5 shown, the link keep-alive state determination device 500 of the embodiment includes a determination module 510 and a first control module 520.

[0101] The determination module 510 is configured to determine the link keep-alive mechanism between the user mode in the first device and the user mode in the second device according to the keep-alive information of the first target network card in the first device and the keep-alive information of the second target network card in the second device. In an embodiment, the determination module 510 can be configured to perform the operation S210 described above, and details are not repeated here.

[0102] The first control module 520 is configured to, in the case that the link keep-alive mechanism is the kernel mode keep-alive mechanism, based on the kernel mode in the first device: control the first target network card to read the memory value of the first target network card from the preset memory according to the keep-alive parameter of the first target network card and the address information of the preset memory, and determine the link keep-alive state between the user mode in the first device and the user mode in the second device according to the read memory value, wherein the memory value of the first target network card in the preset memory is set by the second target network card according to the first atomic request from the first target network card. In an embodiment, the first control module 520 can be configured to perform the operation S220 described above, and details are not repeated here.

[0103] According to an embodiment of the present application, the keep-alive parameter comprises a first time interval and a retry number; the first control module 520 comprises a control unit and a first determination unit.

[0104] The control unit is configured to control the first target network card to repeatedly read the memory value of the first target network card at the first time interval until the number of repeated readings is equal to the retry number or the read memory value is consistent with the expected value.

[0105] The first determination unit is configured to determine that the link keep-alive state is normal connection between the user state in the first device and the user state in the second device in the case that the read memory value is consistent with the expected value and the number of repeated readings is less than or equal to the retry number.

[0106] According to an embodiment of the present application, the first control module 520 further comprises a second determination unit.

[0107] The second determination unit is configured to determine that the link keep-alive state is abnormal connection between the user state in the first device and the user state in the second device in the case that the read memory value is inconsistent with the expected value and the number of repeated readings is equal to the retry number.

[0108] According to an embodiment of the present application, the link keep-alive state determination apparatus 500 further comprises a second control module and an update module.

[0109] The second control module is configured to control the first target network card to compare the memory value of the second target network card read from the preset area of the second target network card with a first comparison value in the second atomic operation request in response to the second atomic operation request from the second target network card.

[0110] The update module is configured to control the first target network card to update the memory value of the second target network card with a first update value in the second atomic operation request in the case that the read memory value of the second target network card is consistent with the first comparison value.

[0111] According to an embodiment of the present application, the link keep-alive state determination apparatus 500 further comprises a third control module.

[0112] The third control module is configured to control the first target network card to periodically send the first atomic operation request to the second target network card at the first time interval, so that the second target network card updates the memory value of the first target network card according to a second update value and a second comparison value in the first atomic operation request.

[0113] According to an embodiment of the present application, the link keep-alive mechanism comprises a kernel state keep-alive mechanism and a user state keep-alive mechanism; the determination module 510 comprises a third determination unit and a fourth determination unit.

[0114] The third determining unit is configured to determine that the link keep-alive mechanism between the user state in the first device and the user state in the second device is the kernel state keep-alive mechanism, in a case where the keep-alive information of the first target network card indicates that the first target network card supports accurate keep-alive and the keep-alive information of the second target network card indicates that the second target network card supports accurate keep-alive.

[0115] The fourth determining unit is configured to determine that the link keep-alive mechanism between the user state in the first device and the user state in the second device is the user state keep-alive mechanism, in a case where the keep-alive information of the first target network card indicates that the first target network card does not support accurate keep-alive and / or the keep-alive information of the second target network card indicates that the second target network card does not support accurate keep-alive.

[0116] According to an embodiment of the present application, the link keep-alive state determining apparatus 500 further comprises a fourth control module and a fifth control module.

[0117] The fourth control module is configured to control the first target network card to periodically send a keep-alive request to the second target network card at a second time interval, in a case where the link keep-alive mechanism is the user state keep-alive mechanism.

[0118] The fifth control module is configured to control the link between the user state in the first device and the user state in the second device to be disconnected, in a case where the first target network card does not receive a keep-alive response from the second target network card within a preset time period.

[0119] According to an embodiment of the present application, any of the determining module 510 and the first control module 520 can be combined in one module, or any of the modules can be split into multiple modules. Alternatively, at least part of the function of one or more of the modules can be combined with at least part of the function of the other modules, and implemented in one module. According to an embodiment of the present application, at least one of the determining module 510 and the first control module 520 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on board, a system on package, an application specific integrated circuit (ASIC), or any other reasonable manner of hardware or firmware by integrating or packaging the circuit, or implemented in any one of software, hardware and firmware or in a proper combination of any of them. Alternatively, at least one of the determining module 510 and the first control module 520 can be at least partially implemented as a computer program module which can perform the corresponding function when the computer program module is run.

[0120] Figure 6 A block diagram of an electronic device suitable for implementing the link keep-alive state determining method according to an embodiment of the present application is schematically shown.

[0121] AsFigure 6 As shown, the electronic device 600 according to embodiments of the present application includes a processor 601, which can perform various appropriate actions and processes according to programs stored in a read only memory (ROM) 602 or loaded from a storage section 608 into a random access memory (RAM) 603. The processor 601 can include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor, and / or a related chip set, and / or a special purpose microprocessor (e.g., an application specific integrated circuit (ASIC)), and so on. The processor 601 can also include an on-board memory for cache use. The processor 601 can include a single processing unit or multiple processing units for executing different actions of the method processes according to embodiments of the present application.

[0122] In the RAM 603, various programs and data required for the operation of the electronic device 600 are stored. The processor 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. The processor 601 performs various operations of the method processes according to embodiments of the present application by executing the programs in the ROM 602 and / or the RAM 603. Note that the programs can also be stored in one or more memories other than the ROM 602 and the RAM 603. The processor 601 can also perform various operations of the method processes according to embodiments of the present application by executing the programs stored in the one or more memories.

[0123] According to embodiments of the present application, the electronic device 600 can also include an input / output (I / O) interface 605, which is also connected to the bus 604. The electronic device 600 can also include one or more of the following components connected to the input / output (I / O) interface 605: an input section 606 including a keyboard, a mouse, etc.; an output section 607 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 608 including a hard disk, etc.; and a communication section 609 including a network interface card such as a LAN card, a modem, etc. The communication section 609 performs communication processing via a network such as the Internet. A drive 610 is also connected to the input / output (I / O) interface 605 as necessary. A removable medium 611 such as a magnetic disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 610 as necessary, so that a computer program read out from the removable medium 611 is installed in the storage section 608 as necessary.

[0124] The application further provides a computer readable storage medium, which can be included in the device / apparatus / system described in the above embodiments, or can exist independently without being assembled into the device / apparatus / system. The computer readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of the application.

[0125] According to the embodiments of the application, the computer readable storage medium can be a non-volatile computer readable storage medium, which can include, but is not limited to, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any appropriate combination thereof. In this application, a computer readable storage medium can be any tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to the embodiments of the application, the computer readable storage medium can include one or more of the above-described ROM 602 and / or RAM 603 and / or one or more memories other than the ROM 602 and the RAM 603.

[0126] The embodiments of the application also include a computer program product, which includes a computer program containing program codes for executing the methods shown in the flowcharts. When the computer program product is run in a computer system, the program codes are used to make the computer system implement the link keep-alive state determination method provided by the embodiments of the application.

[0127] The above-described functions defined in the system / apparatus of the embodiments of the application are performed when the computer program is executed by the processor 601. According to the embodiments of the application, the above-described system, apparatus, module, unit, etc. can be implemented by computer program modules.

[0128] In one embodiment, the computer program can rely on a tangible storage medium such as an optical storage device, a magnetic storage device, etc. In another embodiment, the computer program can also be transmitted, distributed, and downloaded in the form of a signal on a network medium, and be downloaded and installed through the communication part 609 and / or installed from the detachable medium 611. The program codes contained in the computer program can be transmitted by any appropriate network medium, including but not limited to wireless, wired, etc., or any appropriate combination thereof.

[0129] In such embodiments, the computer program can be downloaded and installed from the network via the communication section 609, and / or installed from the removable media 611. When the computer program is executed by the processor 601, the above-described functions defined in the system of the embodiments of the present application are performed. According to the embodiments of the present application, the system, device, apparatus, module, unit, and the like described above can be realized by the computer program module.

[0130] According to the embodiments of the present application, the program code for executing the computer program provided by the embodiments of the present application can be written in any combination of one or more programming languages, and specifically, these computer programs can be implemented using high-level procedural and / or object-oriented programming language, and / or assembly / machine language. The programming language includes, but is not limited to, such as Java, C++, python, "C" language, or similar programming language. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case involving a remote computing device, the remote computing device can be connected to the user computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, connected to the Internet through an Internet service provider).

[0131] The flowcharts and block diagrams in the drawings illustrate the possible implementation architectures, functions, and operations of the systems, methods, and computer program products according to various embodiments of the present application. In this regard, each block in the flowcharts or block diagrams can represent a module, a program segment, or a portion of code that contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different orders than that shown in the figures. For example, two blocks that are shown in succession can actually be executed substantially concurrently, or they can sometimes be executed in reverse order, depending on the functionality involved. It should also be noted that each block in the block diagrams or flowcharts, and combinations of blocks in the block diagrams or flowcharts, can be implemented by a dedicated hardware-based system that performs specified functions or operations, or can be implemented by a combination of special-purpose hardware and computer instructions.

[0132] Those skilled in the art can understand that the features described in various embodiments of the present application can be combined and / or integrated in various combinations, even if such combinations are not explicitly described in the present application. In particular, the features described in various embodiments of the present application can be combined and / or integrated in various combinations without departing from the spirit and teachings of the present application. All such combinations and / or integrations are within the scope of the present application.

[0133] The embodiments of the application have been described. However, these embodiments are merely for illustration and are not intended to limit the scope of the application. Although each embodiment is described above separately, this does not mean that the measures in each embodiment cannot be used advantageously in combination. Various alternatives and modifications to the embodiments described herein will be apparent to those skilled in the art in view of the foregoing description. Such alternatives and modifications are intended to fall within the scope of the application.

Claims

1. A method for determining a link keep-alive state, the method comprising: The method comprises: According to the first target network card in the first device and the second target network card in the second device, the link alive mechanism between the user state in the first device and the user state in the second device is determined; In the case that the link alive mechanism is the kernel state alive mechanism, based on the kernel state in the first device: Control the first target network card to read the memory value of the first target network card from the preset memory according to the alive parameter of the first target network card and the address information of the preset memory, and determine the link alive state between the user state in the first device and the user state in the second device according to the read memory value, including: control the first target network card to repeatedly read the memory value of the first target network card at a first time interval until the repeated reading times equal to the retry times or the read memory value is consistent with the expected value; In the case that the read memory value is consistent with the expected value and the repeated reading times is less than or equal to the retry times, it is determined that the link alive state is that the link connection between the user state in the first device and the user state in the second device is normal, wherein the memory value of the first target network card in the preset memory is set by the second target network card according to the first atomic operation request from the first target network card, and the alive parameter includes the first time interval and the retry times.

2. The method of claim 1, wherein, The method further comprises: In the case that the read memory value is not consistent with the expected value and the repeated reading times is equal to the retry times, it is determined that the link alive state is that the link connection between the user state in the first device and the user state in the second device is abnormal.

3. The method of claim 1, wherein, The method further comprises: In response to the second atomic operation request from the second target network card, control the first target network card to compare the memory value of the second target network card read from the preset area of the second target network card with the first comparison value in the second atomic operation request; In the case that the read memory value of the second target network card is consistent with the first comparison value, control the first target network card to update the memory value of the second target network card with the first update value in the second atomic operation request.

4. The method of claim 3, wherein, The method further comprises: Control the first target network card to periodically send the first atomic operation request to the second target network card at the first time interval, so that the second target network card updates the memory value of the first target network card according to the second update value and the second comparison value in the first atomic operation request.

5. The method of claim 1, wherein, The link alive mechanism includes the kernel state alive mechanism and the user state alive mechanism; the link alive mechanism between the user state in the first device and the user state in the second device is determined according to the alive information of the first target network card in the first device and the alive information of the second target network card in the second device, comprising: In a case where the keep-alive information of the first target network card indicates that the first target network card supports accurate keep-alive and the keep-alive information of the second target network card indicates that the second target network card supports accurate keep-alive, it is determined that the link keep-alive mechanism between the user state in the first device and the user state in the second device is the kernel state keep-alive mechanism; In a case where the keep-alive information of the first target network card indicates that the first target network card does not support accurate keep-alive and / or the keep-alive information of the second target network card indicates that the second target network card does not support accurate keep-alive, it is determined that the link keep-alive mechanism between the user state in the first device and the user state in the second device is the user state keep-alive mechanism.

6. The method of claim 5, wherein, In a case where the link keep-alive mechanism is the user state keep-alive mechanism, the method further comprises: controlling the first target network card to periodically send a keep-alive request to the second target network card at a second time interval; in a case where the first target network card does not receive a keep-alive response from the second target network card within a preset time period, controlling the link between the user state in the first device and the user state in the second device to be disconnected.

7. A link keep-alive state determining apparatus characterized by comprising: The apparatus comprises: a determination module configured to determine, according to keep-alive information of a first target network card in a first device and keep-alive information of a second target network card in a second device, a link keep-alive mechanism between a user state in the first device and a user state in the second device; a first control module configured to, in a case where the link keep-alive mechanism is a kernel state keep-alive mechanism, control, based on a kernel state in the first device: control the first target network card to read a memory value of the first target network card from a preset memory according to keep-alive parameters of the first target network card and address information of the preset memory, and determine, according to the read memory value, a link keep-alive state between the user state in the first device and the user state in the second device, wherein the memory value of the first target network card in the preset memory is set by the second target network card according to a first atomic request from the first target network card, and the keep-alive parameters comprise a first time interval and a retry number; wherein the first control module comprises a control unit and a first determination unit; the control unit is configured to control the first target network card to repeatedly read the memory value of the first target network card at the first time interval until the number of repeated readings is equal to the retry number or the read memory value is consistent with an expected value; the first determination unit is configured to, in a case where the read memory value is consistent with the expected value and the number of repeated readings is less than or equal to the retry number, determine that the link keep-alive state is that the link between the user state in the first device and the user state in the second device is connected normally.

8. An electronic device comprising: one or more processors; a memory for storing one or more computer programs, characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1-6.

9. A computer readable storage medium having stored thereon a computer program or instructions, characterized in that, The computer program or instructions are executed by the processor to implement the steps of the method according to any one of claims 1-6.

Citation Information

Patent Citations

  • Link state determination method and device of physical layer equipment, equipment and storage medium

    CN116366520A

  • Method and device for acquiring network throughput data in real time

    CN117155827A