A method, apparatus and electronic device for configuring a communication link

By adding the mctp attribute and custom members to the adapter, the MCTP communication link can be dynamically configured, solving the problem of the inability to flexibly configure and remove links in the existing technology, and realizing efficient management of MCTP communication links.

CN118945054BActive Publication Date: 2026-06-23NETTRIX INFORMATION IND CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NETTRIX INFORMATION IND CO LTD
Filing Date
2024-07-23
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

Existing technologies cannot flexibly configure MCTP communication links according to application scenarios, nor can they dynamically remove links that are no longer needed, resulting in a waste of resources and time.

Method used

By matching the input string with the preset command word, the command word type is determined to dynamically add or remove MCTP communication links. The newly added mctp attributes and custom members are used to configure and query the MCTP communication link status of the adapter, avoiding the need for pre-configuration of the DTS file.

Benefits of technology

It enables the dynamic addition and removal of MCTP communication links, reducing resource and time waste and improving configuration flexibility and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118945054B_ABST
    Figure CN118945054B_ABST
Patent Text Reader

Abstract

The application relates to a communication link configuration method, device and electronic equipment. The method comprises the following steps: obtaining an input string, matching the input string with a preset command word; if the input string is successfully matched with the preset command word, determining whether the matched command word is a first command word or a second command word; when the matched command word is the first command word, traversing an MCTP server device chain table to determine an MCTP device instance corresponding to a chain table head of a target adapter; and removing an MCTP communication link of the MCTP device instance. Based on the above method, the MCTP communication link can be dynamically removed, and the blank space in the MCTP communication link application which cannot be dynamically configured is filled.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus and electronic device for configuring a communication link. Background Technology

[0002] MCTP over I2C is a technology for managing the transmission of network protocols between hardware components on the I2C bus. When multiple hardware components supporting the MCTP protocol are connected to the same I2C bus, each communication stream is assigned a unique identifier, which, combined with its different I2C address, distinguishes different communication sessions, thereby achieving MCTP multiplexing.

[0003] However, when multiple hardware components share the same address, the I2C bus cannot distinguish between them. Therefore, an I2C switch (a device used to extend the I2C bus) is needed for channel expansion. Hardware components are connected to different channels, and communication with different hardware components sharing the same address is achieved by switching channels. Each channel extended by the I2C switch is a virtual I2C adapter. To achieve multiplexing on the I2C bus, an independent MCTP communication link must be established for each virtual I2C adapter requiring MCTP communication.

[0004] Currently, MCTP communication links are established by configuring the DTS (Device Tree Source) file in the kernel, marking the target I2C adapter with MCTP communication requirements with the "mctp_controller" attribute. This indicates that the target I2C adapter needs to establish an MCTP communication link. After system startup, the MCTP over I2C driver looks up this attribute and completes the relevant MCTP communication link establishment process. This method of establishing MCTP communication links is simplistic, cannot be flexibly configured according to application scenarios, and cannot remove MCTP communication links that are no longer needed. Summary of the Invention

[0005] This application provides a method, apparatus, and electronic device for configuring communication links, which enables the dynamic addition or removal of MCTP communication links.

[0006] Firstly, this application provides a method for configuring a communication link, the method comprising:

[0007] Obtain the input string and match the input string with a preset command word;

[0008] If the input string matches the preset command word successfully, then the successfully matched command word is determined to be either the first command word or the second command word;

[0009] When the command word is the first command word, traverse the MCTP server device list to determine the MCTP device instance corresponding to the head of the target adapter list, wherein the target adapter is the adapter specified by the input string;

[0010] Remove the MCTP communication link from the MCTP device instance.

[0011] By matching the input string with preset command words, and setting the trigger conditions for removing MCTP communication links based on the matching results, dynamic removal of MCTP communication links is achieved, solving the problem that existing methods for configuring MCTP communication links through DTS cannot remove unwanted MCTP communication links.

[0012] In one possible design, removing the MCTP communication link of the MCTP device instance includes: terminating the sending thread on the MCTP device instance; deregistering the MCTP device instance after the data currently being transmitted on the sending thread has been completely received; and updating the value of a custom member in the target adapter structure to a first preset threshold, wherein the custom member is used to store the configuration state of the MCTP communication link of the target adapter, and the first preset threshold indicates that the MCTP communication link of the target adapter is in a closed state.

[0013] The MCTP communication link is shut down by terminating the sending thread of the MCTP device instance and deregistering the MCTP device instance. After removing the MCTP communication link, the configuration status of the target adapter's current MCTP communication link is recorded by updating the value of the custom member, so that the configuration status of the MCTP communication link can be queried directly by reading the value of the custom member later.

[0014] In one possible design, the method further includes: when the command word is the second command word, obtaining the target adapter and the root adapter to which the target adapter is attached; determining whether the target string is the second command word, wherein the target string is obtained by converting the value of a custom member in the target adapter structure; if the target string is the second command word and the MCTP communication link of the root adapter is enabled, traversing the MCTP server device list to determine the head of the target adapter list; establishing the MCTP device instance corresponding to the head of the target adapter list and configuring the network parameters of the MCTP communication link; updating the value of the custom member in the target adapter structure to a second preset threshold, wherein the second preset threshold indicates that the MCTP communication link of the target adapter is enabled.

[0015] By matching the input string with preset command words, the trigger conditions for adding MCTP communication links are set according to the matching results, thereby realizing the dynamic addition of MCTP communication links.

[0016] In one possible design, before determining whether the target string is the second command word, the method further includes: a read operation function based on the mctp attribute of the target adapter, reading the value of a custom member in the target adapter structure, wherein the mctp attribute is an attribute that supports the request to configure an MCTP communication link on any adapter; and converting the value into the target string, wherein the target string is the first command word or the second command word.

[0017] The request to configure the MCTP communication link on the adapter is supported by adding the mctp attribute to the adapter's attribute set, and a read operation function is set to query the current MCTP communication link configuration of the adapter.

[0018] In one possible design, after determining whether the target string is the second command word, the method further includes: if the target string is not the second command word, then the operation ends; or, if the target string is the second command word, but the MCTP communication link of the root adapter is not enabled, then the operation ends.

[0019] When the target string of the custom member's numerical conversion does not meet the triggering conditions for adding an MCTP communication link, the operation ends directly, reducing the waste of resources and time compared to existing technologies.

[0020] In one possible design, before obtaining the input string, the method further includes: adding the mctp attribute to the attribute set of the adapter device type; adding the custom member to the adapter structure and assigning a value to the custom member according to the configuration status of the adapter's MCTP communication link; setting a read operation function and a write operation function for the mctp attribute, wherein the read operation function is used to query the MCTP communication link status of the adapter, and the write operation function is used to configure the MCTP communication link of the adapter.

[0021] By adding an `mctp` attribute to the adapter device type's attribute set to support configuring MCTP communication links, and adding a custom member to the adapter structure to store the current MCTP configuration status, the MCTP communication links of the adapter can be dynamically configured and their configuration status can be queried. This eliminates the need to pre-configure the DTS file before adding MCTP communication links.

[0022] Secondly, this application provides a configuration apparatus for a communication link, the apparatus comprising:

[0023] The matching module 301 acquires the input string and matches the input string with a preset command word;

[0024] The judgment module 302 determines whether the input string matches the preset command word successfully or not.

[0025] The determination module 303, when the preset command word is the first command word, traverses the MCTP server device list to determine the MCTP device instance corresponding to the head of the target adapter list, wherein the target adapter is the adapter specified by the input string;

[0026] Remove module 304 to remove the MCTP communication link of the MCTP device instance.

[0027] In one possible design, the removal module 304 is specifically used to: terminate the sending thread on the MCTP device instance; deregister the MCTP device instance after the data currently being transmitted on the sending thread has been completely received; and update the value of the custom member in the target adapter structure to a first preset threshold, wherein the custom member is used to store the configuration status of the MCTP communication link of the target adapter, and the first preset threshold indicates that the MCTP communication link of the target adapter is in a closed state.

[0028] In one possible design, the device is further configured to: when the command word is the second command word, obtain the target adapter and the root adapter to which the target adapter is attached; determine whether the target string is the second command word, wherein the target string is obtained by converting the value of a custom member in the target adapter structure; if the target string is the second command word and the MCTP communication link of the root adapter is enabled, traverse the MCTP server device list to determine the head of the target adapter list; establish the MCTP device instance corresponding to the head of the target adapter list and configure the network parameters of the MCTP communication link; update the value of the custom member in the target adapter structure to a second preset threshold, wherein the second preset threshold indicates that the MCTP communication link of the target adapter is enabled.

[0029] In one possible design, the device is further configured to: read the value of a custom member in the target adapter structure based on a read operation function of the mctp attribute of the target adapter, wherein the mctp attribute is an attribute that supports a request to configure an MCTP communication link on any adapter; and convert the value into the target string, wherein the target string is the first command word or the second command word.

[0030] In one possible design, the device is also used to: terminate the operation if the target string is not the second command word; or terminate the operation if the target string is the second command word, but the MCTP communication link of the root adapter is not enabled.

[0031] In one possible design, the device is further configured to: add the mctp attribute to the attribute set of the adapter device type; add the custom member to the adapter structure and assign a value to the custom member according to the configuration status of the adapter's MCTP communication link; and set a read operation function and a write operation function for the mctp attribute, wherein the read operation function is used to query the MCTP communication link status of the adapter, and the write operation function is used to configure the MCTP communication link of the adapter.

[0032] Thirdly, this application provides an electronic device, the electronic device comprising:

[0033] Memory, used to store computer programs;

[0034] When a processor executes a computer program stored in the memory, it implements the above-described method steps for configuring a communication link.

[0035] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method steps for configuring a communication link.

[0036] For the various aspects of the second to fourth aspects mentioned above, and the technical effects that each aspect may achieve, please refer to the above description of the technical effects that can be achieved for the first aspect or the various possible solutions in the first aspect, which will not be repeated here. Attached Figure Description

[0037] Figure 1 A flowchart illustrating a communication link configuration method provided in this application;

[0038] Figure 2 A flowchart illustrating a method for adding an MCTP communication link provided in this application;

[0039] Figure 3 This application provides a complete flowchart for configuring an MCTP communication link;

[0040] Figure 4 A schematic diagram of a communication link configuration device provided in this application;

[0041] Figure 5A schematic diagram of the structure of an electronic device provided in this application. Detailed Implementation

[0042] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The specific operating methods in the method embodiments can also be applied to the device embodiments or system embodiments.

[0043] In the description of this application, "multiple" is understood as "at least two". "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. A connected to B can represent: A and B directly connected, or A and B connected through C. Furthermore, in the description of this application, terms such as "first" and "second" are used only for descriptive purposes and should not be construed as indicating or implying relative importance or order.

[0044] To facilitate a better understanding of the technical solutions provided in the embodiments of this application by those skilled in the art, the following is a brief explanation of the relevant technical terms:

[0045] MCTP (Management Component Transport Protocol) is a network protocol used to manage communication between hardware components. It provides a hardware abstraction layer that allows different hardware components (such as motherboards, BMCs, sensors, and other add-on cards) to communicate and exchange management data in a standardized manner, without having to worry about the specific implementation of the underlying hardware. It is a "data link layer" protocol that is independent of the physical bus.

[0046] I2C (IIC, Inter-Integrated Circuit) is an integrated circuit bus, a serial communication bus that allows multiple devices to communicate through a shared serial data line and clock line. It is widely used in embedded systems and hardware devices to connect microcontrollers and other devices.

[0047] Sysfs (System Filesystem) is a virtual file system provided by the Linux kernel to expose information about devices and drivers to user space. Sysfs organizes information through files and directories, where each file or directory corresponds to a device, driver, or other kernel object in the system. These files typically contain attributes, status, and configuration information about the devices and drivers. Some files are writable for configuring and controlling devices.

[0048] The present application will now be described in further detail with reference to the accompanying drawings. See also: Figure 1 The diagram shown is a flowchart illustrating a communication link configuration method provided in an embodiment of this application. The specific implementation process of this method is as follows:

[0049] Step 101: Obtain the input string and match it with the preset command words;

[0050] In this embodiment of the application, before obtaining the input string, the adapter (including the root adapter and the virtual adapter) needs to be configured as follows:

[0051] 1. Add a new attribute, mctp, to the attribute set of the adapter device type. When registering the adapter, the mctp attribute will be attached to the adapter to support requests to configure MCTP communication links on any adapter.

[0052] 2. Add a custom member `mctp_enable` to the adapter structure. `mctp_enable` is used to store the current MCTP communication link configuration status of the adapter. Assign a value to `mctp_enable`. The first threshold indicates that the current MCTP communication link of the adapter is in a closed state, and the second threshold indicates that the current MCTP communication link of the adapter is in an open state.

[0053] 3. Set the read and write operation functions for the MCTP attributes. The read operation function allows user space to write to kernel objects through the Sysfs file system to query the status of the MCTP communication link. The write operation function allows user space to write to kernel objects through the Sysfs file system to configure the MCTP communication link.

[0054] By adding the mctp attribute to the attribute set of the adapter device type and adding the mctp_enable member to the adapter structure, the MCTP communication link of the adapter can be dynamically configured and the current configuration state of the MCTP communication link can be saved, eliminating the need to pre-configure the DTS file before adding the MCTP communication link.

[0055] After configuring the adapter, the input string is obtained and matched against preset command words. Preset command words may include, but are not limited to: first command word OFF, second command word ON.

[0056] Specifically, the input string passed in for the write operation is matched with the preset command word. When the input string matches the preset command word, the match is successful, indicating that it is a valid configuration request, and then the operation of step 102 below is executed.

[0057] For example, receiving the shell command `echo on>mctp` indicates writing the string "on" to the `mctp` device node. This "on" string is then passed as an argument to the kernel driver's write operation function. The "on" string is compared to a preset command word, which includes two types: a first command word (OFF) and a second command word (ON). If the "on" string matches the second command word (ON), the match is successful.

[0058] In one possible implementation, when the input string does not match the preset command word, the matching fails, and a prompt message is output to the terminal that initiated the request. The prompt message includes, but is not limited to, the supported command format and the usage method of the command format.

[0059] For example, if the shell command `set mctp` is received, it means writing the string `set mctp` to the `mctp` device node. In this case, the `set mctp` string is passed as an argument to the kernel driver's write operation function. The `set mctp` string is compared with the default command words `on` / `off`. `set mctp` does not match either `on` or `set mctp`, so the match fails. At this point, a matching failure message will be output to the terminal that initiated the request. This message may include: `eho[cmd]>mctp`; `cmd:on|off`; `eho[on]>mctp`. Here, `eho[cmd]>mctp` indicates the correct way to input the command, and `cmd:on|off` indicates that the correct command string is `on` or `off`. `eho[on]>mctp` is an example of inputting the `on` command.

[0060] Step 102: If the input string matches the preset command word, determine whether the matched command word is the first command word or the second command word;

[0061] In this embodiment of the application, when the input string successfully matches the preset command word, it is determined that the successfully matched command word is the first command word or the second command word.

[0062] The operation request type of the input string is determined by judging the type of the successfully matched command word. For example, if the successfully matched command word is the first command word OFF, it means that the operation request type of the input string is to remove the MCTP communication link; if the successfully matched command word is the second command word ON, it means that the operation request type of the input string is to add the MCTP communication link.

[0063] In one possible implementation, if the successfully matched command word is the first command word, then the following step 103 is performed.

[0064] In one possible implementation, if the successfully matched command word is the second command word, then the operation of adding an MCTP communication link is performed. See details below. Figure 2 The diagram shows a flowchart of the method for adding an MCTP communication link. The specific implementation process is as follows:

[0065] Step 201: When the command word is the second command word, obtain the target adapter and the root adapter to which the target adapter depends;

[0066] Step 202: Determine if the target string is a second command word;

[0067] In this embodiment, the target string is obtained by converting the number of a custom member in the target adapter structure.

[0068] Specifically, before determining whether the target string is the second command word, it is necessary to use the read operation function of the MCTP attribute associated with the Sysfs subsystem to read the current value of the custom member mctp_enable in the target adapter's structure. This value can be either a first preset threshold or a second preset threshold. The first preset threshold indicates that the MCTP communication link of the target adapter is in a closed state, while the second preset threshold indicates that the MCTP communication link of the target adapter is in an open state.

[0069] Convert the current value of mctp_enable to a target string, which is either the first command word OFF or the second command word ON. Specifically, if the current value of mctp_enable is the first preset threshold, it will be converted to the first command word OFF; if the current value of mctp_enable is the second preset threshold, it will be converted to the second command word ON.

[0070] Get the target string and determine if the target string is a second command word.

[0071] In one possible implementation, if the target string is a second command word, then the operation of step 203 below is performed.

[0072] In one possible implementation, if the target string is not the second command word, then the operation of step 204 below is performed.

[0073] Step 203: Determine whether the MCTP communication link of the root adapter is enabled;

[0074] Specifically, if the MCTP communication link of the root adapter is already enabled, then perform the following step 205.

[0075] If the MCTP communication link of the root adapter is not enabled, proceed to step 204.

[0076] Step 204: End operation;

[0077] Specifically, when the target string is not the second command word ON, that is, when the target adapter's current MCTP communication link is closed, or when the root adapter's MCTP communication link is not open, it is impossible to add an MCTP communication link to the target adapter.

[0078] Step 205: Add an MCTP communication link to the target adapter.

[0079] Specifically, when the target string is the second command word ON and the MCTP communication link of the root adapter is enabled, the MCTP server device list is traversed to find the head of the target adapter list.

[0080] Create an MCTP device instance corresponding to the head of the target adapter's linked list, configure the network parameters of the MCTP communication link, and register the MCTP network device.

[0081] Finally, the number of the custom member mctp_enable in the target adapter structure is updated to the second preset value, which indicates that the target adapter's current MCTP communication link is enabled.

[0082] Step 103: When the successfully matched command word is the first command word, traverse the MCTP server device list to determine the MCTP device instance corresponding to the head of the target adapter's list;

[0083] In this embodiment, the target adapter is the adapter specified by the input string, i.e., the adapter for which MCTP communication links need to be added or removed.

[0084] Specifically, when the successfully matched command word is the first command word OFF, it indicates that the MCTP link of the target adapter needs to be removed. Then, the MCTP server device list is traversed to find the MCTP device instance corresponding to the head of the target adapter list.

[0085] Step 104: Remove the MCTP communication link from the MCTP device instance.

[0086] Specifically, first, the sending thread on the MCTP device instance corresponding to the head of the target adapter's linked list is terminated. After the data currently being transmitted on the sending thread is completely received, data reception is stopped. Then, the MCTP device instance is unregistered, and its memory space is released. Finally, the value of the custom member in the target adapter structure is updated to the first preset threshold, which indicates that the MCTP communication link of the target adapter is in a closed state, and the MCTP communication link on the target adapter is removed.

[0087] This application dynamically adds or removes MCTP communication links according to actual application needs by matching terminal input strings with preset command words and setting trigger conditions for removing and adding MCTP communication links of target adapters based on different matching results. Furthermore, by adding read operation functions for the mctp attribute to perform read operations on the kernel object to query the MCTP communication link status of the adapter, and by adding write operation functions for the mctp attribute to perform write operations on the kernel object to configure the MCTP communication links.

[0088] The following is combined with Figure 3 This application provides a complete and detailed description of the configuration method for the communication link provided in the embodiments.

[0089] This method associates the read and write operation functions of MCTP attributes through the sysfs subsystem. The read operation function is used to query the current MCTP communication link configuration status, and the write operation function is used to configure the MCTP communication link, including adding and removing links.

[0090] First, obtain the string written by the terminal and match the string with the known preset command words ON / OFF.

[0091] In one possible implementation, if the written string does not match the preset command word ON / OFF and the match fails, a prompt message indicating the method and command format for configuring the MCTP communication link is output to the terminal.

[0092] In one possible implementation, if the written string matches the preset command word ON / OFF, the match is successful, and then it is determined whether the successfully matched command word is ON or OFF.

[0093] If the matched command word is ON, then the operation of adding an MCTP communication link will be executed, specifically:

[0094] Retrieve the target adapter and its attached root adapter, and read the value of the custom member mctp_enable in the target adapter structure through the read operation function, and convert the value into the target string on or off.

[0095] When the target string is "off", it indicates that the target adapter's current MCTP communication link is closed, and MCTP communication link configuration cannot be performed, so the operation ends.

[0096] When the target string is "on", it checks whether the root adapter to which the target adapter depends has enabled the MCTP communication link. If the root adapter has not enabled the MCTP communication link, the MCTP communication link cannot be configured for the target adapter, and the operation ends.

[0097] If the root adapter enables the MCTP communication link, then the target adapter can be configured with the MCTP communication link. This involves traversing the MCTP server device list, finding the head of the target adapter's list, creating the corresponding MCTP device instance, configuring the MCTP network parameters, registering the MCTP network device, and finally updating the value of the custom member `mctp_enable` in the target adapter's structure to the value corresponding to `on`. This adds the MCTP communication link to the target adapter.

[0098] If the matched command word is OFF, then the operation of removing the MCTP communication link will be performed, specifically:

[0099] Traverse the MCTP server-side device list to find the device instance corresponding to the head of the target adapter's list.

[0100] Terminate the sending thread on the device, wait for complete data reception, and then stop receiving. Deregister the MCTP network device and release its memory space. Finally, update the value of the custom member `mctp_enable` in the target adapter structure to the value corresponding to `off`, thus removing the MCTP communication link from the target adapter.

[0101] The above method enables dynamic configuration of MCTP communication links, including adding and removing MCTP communication links, thus solving the problem that existing technologies cannot dynamically configure MCTP communication links.

[0102] It is worth noting that the solution provided in this application embodiment is embedded in the I2C subsystem, which is compatible with the existing technical solution of configuring MCTP communication links through DTS. It has universality and portability, and provides a quick and easy way to develop application layer functions.

[0103] Based on the same inventive concept, this application also provides a communication link configuration device for dynamically adding or removing MCTP communication links, solving the problem that existing technologies cannot dynamically configure MCTP communication links. See [link to related document]. Figure 4 The device includes:

[0104] The matching module 401 acquires the input string and matches the input string with a preset command word;

[0105] The judgment module 402 determines whether the input string matches the preset command word successfully or not.

[0106] The determination module 403, when the preset command word is the first command word, traverses the MCTP server device list to determine the MCTP device instance corresponding to the head of the target adapter list, wherein the target adapter is the adapter specified by the input string;

[0107] Remove module 404 to remove the MCTP communication link of the MCTP device instance.

[0108] In one possible design, the removal module 404 is specifically used to: terminate the sending thread on the MCTP device instance; deregister the MCTP device instance after the data currently being transmitted on the sending thread has been completely received; and update the value of the custom member in the target adapter structure to a first preset threshold, wherein the custom member is used to store the configuration status of the MCTP communication link of the target adapter, and the first preset threshold indicates that the MCTP communication link of the target adapter is in a closed state.

[0109] In one possible design, the device is further configured to: when the command word is the second command word, obtain the target adapter and the root adapter to which the target adapter is attached; determine whether the target string is the second command word, wherein the target string is obtained by converting the value of a custom member in the target adapter structure; if the target string is the second command word and the MCTP communication link of the root adapter is enabled, traverse the MCTP server device list to determine the head of the target adapter list; establish the MCTP device instance corresponding to the head of the target adapter list and configure the network parameters of the MCTP communication link; update the value of the custom member in the target adapter structure to a second preset threshold, wherein the second preset threshold indicates that the MCTP communication link of the target adapter is enabled.

[0110] In one possible design, the device is further configured to: read the value of a custom member in the target adapter structure based on a read operation function of the mctp attribute of the target adapter, wherein the mctp attribute is an attribute that supports a request to configure an MCTP communication link on any adapter; and convert the value into the target string, wherein the target string is the first command word or the second command word.

[0111] In one possible design, the device is also used to: terminate the operation if the target string is not the second command word; or terminate the operation if the target string is the second command word, but the MCTP communication link of the root adapter is not enabled.

[0112] In one possible design, the device is further configured to: add the mctp attribute to the attribute set of the adapter device type; add the custom member to the adapter structure and assign a value to the custom member according to the configuration status of the adapter's MCTP communication link; and set a read operation function and a write operation function for the mctp attribute, wherein the read operation function is used to query the MCTP communication link status of the adapter, and the write operation function is used to configure the MCTP communication link of the adapter.

[0113] Based on the same inventive concept, this application also provides an electronic device that can implement the function of the aforementioned communication link configuration device. (Refer to...) Figure 5 The electronic device includes:

[0114] At least one processor 501 and a memory 502 connected to at least one processor 501. In this embodiment, the specific connection medium between the processor 501 and the memory 502 is not limited. Figure 5 The example shown is the connection between processor 501 and memory 502 via bus 500. Bus 500 is... Figure 5 The connections between other components are indicated by thick lines and are for illustrative purposes only, not as limiting information. The Bus 500 can be divided into address bus, data bus, control bus, etc., for ease of representation. Figure 5 The term 501 is represented by a single thick line, but this does not imply that there is only one bus or one type of bus. Alternatively, the processor 501 can also be called a controller; there is no restriction on the name.

[0115] In this embodiment, memory 502 stores instructions executable by at least one processor 501. By executing the instructions stored in memory 502, at least one processor 501 can execute the communication link configuration method described above. Processor 501 can implement... Figure 4 The functions of each module in the device shown.

[0116] The processor 501 is the control center of the device. It can connect to various parts of the control device through various interfaces and lines. By running or executing instructions stored in memory 502 and calling data stored in memory 502, the processor can perform various functions and process data, thereby monitoring the device as a whole.

[0117] In one possible design, processor 501 may include one or more processing units. Processor 501 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may also not be integrated into processor 501. In some embodiments, processor 501 and memory 502 may be implemented on the same chip; in some embodiments, they may also be implemented on separate chips.

[0118] Processor 501 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor, application-specific integrated circuit, field-programmable gate array or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the communication link configuration method disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.

[0119] Memory 502, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 502 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory 502 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In the embodiments of this application, memory 502 can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.

[0120] By designing and programming the processor 501, the code corresponding to the application anomaly detection method described in the foregoing embodiments can be embedded into the chip, thereby enabling the chip to execute the code during runtime. Figure 1The steps of the communication link configuration method in the illustrated embodiment are as follows. How to design and program the processor 501 is a technique well-known to those skilled in the art and will not be described further here.

[0121] Based on the same inventive concept, embodiments of this application also provide a storage medium storing computer instructions that, when executed on a computer, cause the computer to perform the configuration method of the communication link described above.

[0122] In some possible implementations, various aspects of the communication link configuration method provided in this application can also be implemented as a program product, which includes program code that, when the program product is run on a device, causes the control device to perform the steps in the communication link configuration method according to the various exemplary embodiments of this application described above.

[0123] Those skilled in the art will understand that embodiments of this application can be provided as methods, apparatus, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0124] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0125] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0126] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0127] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.

Claims

1. A method for configuring a communication link, characterized in that, The method includes: Obtain the input string and match the input string with a preset command word; If the input string matches the preset command word successfully, then the successfully matched command word is determined to be either the first command word or the second command word; When the command word is the first command word, traverse the MCTP server device list to determine the MCTP device instance corresponding to the head of the target adapter list, wherein the target adapter is the adapter specified by the input string; Terminate the sending thread on the MCTP device instance; Once the data currently being transmitted on the sending thread has been completely received, the MCTP device instance is deregistered. The value of the custom member in the target adapter structure is updated to a first preset threshold, wherein the custom member is used to store the configuration status of the MCTP communication link of the target adapter, and the first preset threshold indicates that the MCTP communication link of the target adapter is in a closed state.

2. The method as described in claim 1, characterized in that, The method further includes: When the command word is the second command word, obtain the target adapter and the root adapter to which the target adapter is attached; Determine whether the target string is the second command word, wherein the target string is obtained by converting the value of the custom member in the target adapter structure; If the target string is the second command word and the MCTP communication link of the root adapter is enabled, then traverse the MCTP server device list to determine the head of the target adapter list; Create an MCTP device instance corresponding to the head of the linked list of the target adapter, and configure the network parameters of the MCTP communication link; The value of the custom member in the target adapter structure is updated to a second preset threshold, wherein the second preset threshold indicates that the MCTP communication link of the target adapter is enabled.

3. The method as described in claim 2, characterized in that, Before determining whether the target string is the second command word, the method further includes: The read operation function based on the mctp attribute of the target adapter reads the value of the custom member in the target adapter structure, wherein the mctp attribute is an attribute that supports the request to configure an MCTP communication link on any adapter; The numerical value is converted into the target string, wherein the target string is either the first command word or the second command word.

4. The method as described in claim 2, characterized in that, After determining whether the target string is the second command word, the method further includes: If the target string is not the second command word, then the operation ends; or, If the target string is the second command word, but the MCTP communication link of the root adapter is not enabled, then the operation ends.

5. The method as described in claim 1, characterized in that, Before obtaining the input string, the following is also included: Add the mctp attribute to the attribute set of the adapter device type; Add the custom member to the adapter structure and assign a value to the custom member according to the configuration status of the adapter's MCTP communication link; The MCTP attribute is configured with read and write operation functions, wherein the read operation function is used to query the MCTP communication link status of the adapter, and the write operation function is used to configure the MCTP communication link of the adapter.

6. A configuration device for a communication link, characterized in that, The device includes: The matching module obtains the input string and matches the input string with a preset command word; The judgment module determines whether the input string matches the preset command word successfully or not. The determination module, when the preset command word is the first command word, traverses the MCTP server device list to determine the MCTP device instance corresponding to the head of the target adapter list, wherein the target adapter is the adapter specified by the input string; Remove the module and terminate the sending thread on the MCTP device instance; Once the data currently being transmitted on the sending thread has been completely received, the MCTP device instance is deregistered. The value of the custom member in the target adapter structure is updated to a first preset threshold, wherein the custom member is used to store the configuration status of the MCTP communication link of the target adapter, and the first preset threshold indicates that the MCTP communication link of the target adapter is in a closed state.

7. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, when executing a computer program stored in the memory, implements the method steps of any one of claims 1-5.

8. 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 steps of the method described in any one of claims 1-5.