Communication link configuration method and apparatus, and electronic device

By matching input strings and preset command words, dynamically manage the addition and removal of MCTP communication links, the problem of waste of resources and single configuration methods in the existing technology is solved, and flexible link configuration and status recording is realized, improving The management efficiency of MCTP communication links is achieved.

CN118945054AActive Publication Date: 2024-11-12NETTRIX INFORMATION IND CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202410992899.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-23
Publication Date
2024-11-12
Estimated Expiration
2044-07-23

AI Technical Summary

Technical Problem

The prior art cannot dynamically add or remove MCTP communication links, resulting in wasted resources and time, and the configuration method is single, so it cannot be flexibly configured according to the application scenario.

Method used

By obtaining the input string matches with the preset command word and judging the matching result, setting the trigger conditions for dynamically adding or removing the MCTP communication link, using the MCTP server device link list to traverse the linked list header of the target adapter, terminate the sending thread, and cancel the MCTP device Instance and update custom members to record link status to achieve dynamic configuration of MCTP communication links.

Benefits of technology

It realizes dynamic addition or removal of MCTP communication links according to application scenarios, reduces resource and time waste, provides a flexible configuration method, and solves the problem that no longer needed MCTP communication links are not removed in the prior art.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118945054A_ABST
    Figure CN118945054A_ABST
Patent Text Reader

Abstract

The invention relates to a communication link configuration method and device and electronic equipment, and the method comprises the steps: obtaining an input character string, and carrying out the matching of the input character string with a preset command word; if the input character string is successfully matched with the preset command word, judging that the successfully matched command word is a first command word or a second command word; when the successfully matched command word is the first command word, traversing an MCTP server device linked list, and determining an MCTP device instance corresponding to a linked list header of the target adapter; the MCTP communication link of the MCTP device instance is removed. Based on the method, the MCTP communication link can be effectively and dynamically removed, and the blank that the MCTP communication link cannot be dynamically configured in application is filled up.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a configuration method, device and electronic device for a communication link. Background Art

[0002] MCTP over I2C is a technology used to manage the transmission of hardware component network protocols on the I2C bus. When multiple hardware components that support the MCTP protocol are connected to the same I2C bus, a unique identifier will be assigned to each communication stream, and combined with its different I2C addresses, different communication sessions will be distinguished, thereby achieving MCTP multiplexing.

[0003] However, when multiple hardware components have the same address, the I2C bus cannot distinguish these hardware components by address, so it is necessary to introduce an i2c switch (a device used to extend the I2C bus) for channel expansion, connect the hardware components to different channels, and achieve communication with different hardware components with the same address 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 that has MCTP communication requirements.

[0004] The current method of establishing an MCTP communication link is to configure the DTS (Device Tree Source) file in the kernel to mark the "mctp_controller" attribute for the target i2c adapter that has MCTP communication requirements, indicating that the target i2c adapter needs to establish an MCTP communication link; after the system starts, the MCTP over I2C driver searches for this attribute and completes the relevant establishment process of the MCTP communication link. This method of establishing an MCTP communication link is single, cannot be flexibly configured according to the application scenario, and cannot remove MCTP communication links that are no longer needed. Summary of the invention

[0005] The present application provides a method, device and electronic device for configuring a communication link, so as to dynamically add or remove an MCTP communication link.

[0006] In a first aspect, the present application provides a method for configuring a communication link, the method comprising:

[0007] Obtaining an input string, and matching the input string with a preset command word;

[0008] If the input character string successfully matches the preset command word, determining whether the successfully matched command word is the first command word or the second command word;

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

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

[0011] By matching the input character string with the preset command word and setting the trigger condition for removing the MCTP communication link according to the matching result, the dynamic removal of the MCTP communication link is realized, which solves the problem that the existing method of configuring the MCTP communication link through DTS cannot remove the unnecessary MCTP communication link.

[0012] In a possible design, removing the MCTP communication link of the MCTP device instance includes: terminating a sending thread on the MCTP device instance; deregistering the MCTP device instance after the data currently transmitted on the sending thread is completely received; and updating a value of a custom member in the target adapter structure to a first preset threshold, wherein the custom member is used to store a 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 closed 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 current MCTP communication link of the target adapter 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.

[0014] In a 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-side device linked list to determine the linked list head of the target adapter; establishing an MCTP device instance corresponding to the linked list head of the target adapter, and configuring 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 in an enabled state.

[0015] By matching the input character string with the preset command word and setting the trigger condition for adding the MCTP communication link according to the matching result, the dynamic addition of the MCTP communication link is realized.

[0016] In a possible design, before determining whether the target string is the second command word, the method further includes: reading a 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 converting the value into the target string, wherein the target string is the first command word or the second command word.

[0017] Supports requests to configure an MCTP communication link on an adapter by adding the mctp attribute to the adapter's attribute collection, and sets a read operation function for querying the adapter's current MCTP communication link configuration.

[0018] In a possible design, after determining whether the target string is the second command word, it also includes: if the target string is not the second command word, ending the operation; or, if the target string is the second command word, but the MCTP communication link of the root adapter is not enabled, ending the operation.

[0019] When the target string of the numerical conversion of the custom member does not meet the triggering condition for adding the MCTP communication link, the operation is directly terminated, which reduces the waste of resources and time compared with the prior art.

[0020] In a 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 MCTP communication link of the adapter; and setting a read operation function and a write operation function of 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 the mctp attribute that supports the configuration of the MCTP communication link in the attribute collection of the adapter device type, and adding a custom member for storing the current MCTP configuration status in the adapter structure, the MCTP communication link of the adapter can be dynamically configured and the configuration status of the MCTP communication link can be queried. It is no longer necessary to pre-configure the DTS file to add the MCTP communication link.

[0022] In a second aspect, the present application provides a communication link configuration device, the device comprising:

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

[0024] The judgment module 302 judges whether the successfully matched command word is the first command word or the second command word if the input character string matches the preset command word successfully;

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

[0026] The removal module 304 removes the MCTP communication link of the MCTP device instance.

[0027] In a possible design, the removal module 304 is specifically used to: terminate the sending thread on the MCTP device instance; when the data currently transmitted on the sending thread is completely received, deregister the MCTP device instance; 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 a possible design, the device is further used 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 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 turned on, traverse the MCTP server-side device list to determine the list head of the target adapter; establish an MCTP device instance corresponding to the list head of the target adapter, 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 in an open state.

[0029] In a possible design, the device is further used to: read the value of the custom member in the target adapter structure based on the 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 further used to: if the target string is not the second command word, end the operation; or, if the target string is the second command word but the MCTP communication link of the root adapter is not enabled, end the operation.

[0031] In a possible design, the apparatus is further used 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 MCTP communication link of the adapter; set a read operation function and a write operation function of 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] In a third aspect, the present application provides an electronic device, the electronic device comprising:

[0033] Memory, used to store computer programs;

[0034] The processor is used to implement the above-mentioned steps of the configuration method of a communication link when executing the computer program stored in the memory.

[0035] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned method for configuring a communication link are implemented.

[0036] For each aspect from the second to the fourth aspect and the technical effects that may be achieved by each aspect, please refer to the above description of the technical effects that can be achieved by the first aspect or various possible schemes in the first aspect, and no further details will be given here. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 A flowchart of a method for configuring a communication link provided in this application;

[0038] Figure 2 A flowchart of a method for adding an MCTP communication link provided by the present application;

[0039] Figure 3 A complete flowchart for configuring an MCTP communication link provided by this application;

[0040] Figure 4 A schematic diagram of a communication link configuration device provided by the present application;

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

[0042] In order to make the purpose, technical solution and advantages of the present application more clear, the present application will be further described in detail below in conjunction with the accompanying drawings. The specific operation method in the method embodiment can also be applied to the device embodiment or the system embodiment.

[0043] In the description of this application, "multiple" is understood to be "at least two". "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent three situations: A exists alone, A and B exist at the same time, and B exists alone. A is connected to B, which can represent two situations: A is directly connected to B and A is connected to B through C. In addition, in the description of this application, words such as "first" and "second" are only used for the purpose of distinguishing descriptions, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying order.

[0044] In order to facilitate those skilled in the art to better understand the technical solutions provided by the embodiments of the present application, the following is a brief description of the professional terms involved:

[0045] MCTP (Management Component Transport Protocol) is a network protocol used to manage communications 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 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 shared serial data lines and clock lines. 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 in the form of files and directories, where each file or directory corresponds to a device, driver, or other kernel object in the system. These files usually contain attributes, status, and configuration information about devices and drivers. Some files can be written to configure and control devices.

[0048] The present application is further described in detail below in conjunction with the accompanying drawings. Figure 1 FIG. 1 is a flow chart of a method for configuring a communication link provided in an embodiment of the present application. The specific implementation process of the method is as follows:

[0049] Step 101: Obtain an input string, and match the input string with a preset command word;

[0050] In the embodiment of the present 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. The mctp attribute will be attached to the adapter when registering the adapter to support requests to configure an MCTP communication link on any adapter.

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

[0053] 3. Set the read and write operation functions of mctp attributes. The read operation function allows the user space to write to the kernel object through the Sysfs file system to query the status of the MCTP communication link. The write operation function allows the user space to write to the kernel object 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 the mctp_enable member to the adapter structure, the MCTP communication link of the adapter can be dynamically configured and the configuration status of the current MCTP communication link can be saved. It is no longer necessary to pre-configure the DTS file to add the MCTP communication link.

[0055] After the adapter is configured, an input string is obtained and matched with a preset command word. The preset command word may include but is not limited to: a first command word OFF, and a second command word ON.

[0056] Specifically, the input string passed in by the write operation is matched with the preset command word. When the input string is consistent with the preset command word, the match is successful, indicating that it is a valid configuration request, and the operation of the following step 102 is performed.

[0057] For example, receiving the shell command echo on>mctp means writing an on string to the mctp device node. At this time, the on string will be passed as a parameter to the write operation function of the kernel driver. The on string is compared with the preset command word, which includes the first command word OFF and the second command word ON. If the on string is consistent with the second command word ON, the match is successful.

[0058] In a possible implementation, when the input character string is inconsistent with the preset command word, the match fails, and a prompt message is output to the terminal that initiates the request. The prompt message includes but is not limited to: supported command formats and how to use the command formats.

[0059] For example, if the shell command set mctp is received, it means writing a set mctp string to the mctp device node. At this time, the set mctp string will be passed as a parameter to the write operation function of the kernel driver. The set mctp string is compared with the preset command word on / off. Set mctp is not consistent with on or set mctp, so the match fails. At this time, a prompt message indicating that the match failed will be output to the terminal that initiated the request. The prompt message may include: eho[cmd]>mctp; cmd:on|off; eg:eho[on]>mctp. Among them, eho[cmd]>mctp represents the correct way to input the command, cmd:on|off represents that the correct command string is on or off, and eg:eho[on]>mctp is an example of inputting the on command.

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

[0061] In the embodiment of the present application, when the input character 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 a possible implementation manner, if the successfully matched command word is the first command word, the operation of the following step 103 is performed.

[0064] In a possible implementation manner, if the successfully matched command word is the second command word, an operation of adding an MCTP communication link is performed. Figure 2 As shown, it is a flow chart of the method for adding an MCTP communication link, and the specific implementation process is as follows:

[0065] Step 201: when the command word is the second command word, obtaining a target adapter and a root adapter to which the target adapter is attached;

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

[0067] In the embodiment of the present application, the target string is obtained by digital conversion of a custom member in the target adapter structure.

[0068] Specifically, before determining whether the target string is the second command word, it is also necessary to use a read operation function based on the Sysfs subsystem-associated mctp attribute to read the current value of the custom member mctp_enable in the structure of the target adapter through the read operation function. The value may be a first preset threshold or a second preset threshold, wherein the first preset threshold indicates that the MCTP communication link of the target adapter is in a closed state, and the second preset threshold indicates that the MCTP communication link of the target adapter is in an open state.

[0069] The current value of mctp_enable is converted into a target string, which is 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 is converted into the first command word OFF; if the current value of mctp_enable is the second preset threshold, it is converted into the second command word ON.

[0070] A target character string is obtained, and it is determined whether the target character string is a second command word.

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

[0072] In a possible implementation, if the target character string is not the second command character, the operation of the following step 204 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 enabled, the operation of step 205 is performed.

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

[0076] Step 204: End the operation;

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

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

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

[0080] Create an MCTP device instance corresponding to the target adapter's linked list header, 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 a second preset value, and the second preset threshold indicates that the current MCTP communication link of the target adapter is in an enabled state.

[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 list head of the target adapter;

[0083] In the embodiment of the present application, the target adapter is the adapter specified by the input string, that is, the adapter to which the MCTP communication link needs to be added or removed.

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

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

[0086] Specifically, first, terminate the sending thread on the MCTP device instance corresponding to the linked list head of the target adapter, wait for the data currently transmitted on the sending thread to be completely received, stop receiving data, then deregister the MCTP device instance, release the memory space of the MCTP device instance, and finally, update the value of the custom member in the target adapter structure to the first preset threshold, indicating 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] The present application matches the terminal input string with the preset command word, and sets the triggering conditions for removing the MCTP communication link of the target adapter and the triggering conditions for adding the MCTP communication link of the target adapter according to different matching results, so that the MCTP communication link can be dynamically added or removed according to actual application requirements. In addition, through the newly added read operation function of the mctp attribute, the kernel object is read to query the MCTP communication link status of the adapter, and through the newly added write operation function of the mctp attribute, the kernel object is written to configure the MCTP communication link.

[0088] Combine the following Figure 3 , a complete and detailed description of the communication link configuration method provided in the embodiment of the present application is given.

[0089] The method associates the read operation function and the write operation function of the mctp attribute through the sysfs subsystem, adopts the read operation function to query the current MCTP communication link configuration state, and adopts the write operation function to configure the MCTP communication link, and the configuration includes adding and removing.

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

[0091] In a possible implementation, if the written character string is inconsistent with the preset command word ON / OFF and the match fails, prompt information on the method and command format for configuring the MCTP communication link is output to the terminal.

[0092] In a possible implementation manner, if the written character string is consistent with the preset command word ON / OFF and the match is successful, it is determined whether the successfully matched command word is ON or OFF.

[0093] If the command word of the successful match is ON, the operation of adding the MCTP communication link is performed, specifically:

[0094] Get 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 current MCTP communication link of the target adapter is closed and the MCTP communication link cannot be configured, so the operation ends.

[0096] When the target string is on, determine whether the root adapter to which the target adapter is attached has the MCTP communication link enabled. If the root adapter has not enabled the MCTP communication link, the MCTP communication link cannot be configured for the target adapter, so the operation ends.

[0097] If the root adapter turns on the MCTP communication link, the MCTP communication link can be configured for the target adapter, the MCTP server device list can be traversed, the target adapter's list header can be found, the corresponding MCTP device instance can be established, the MCTP network parameters can be configured, the MCTP network device can be registered, and finally the value of the custom member mctp_enable in the target adapter structure can be updated to the value corresponding to on, thus adding the MCTP communication link to the target adapter.

[0098] If the command word that matches successfully is OFF, the operation of removing the MCTP communication link is performed, specifically:

[0099] Traverse the MCTP server device list and find the device instance corresponding to the target adapter's list header.

[0100] Terminate the sending thread on the device, wait for the received data to be complete, and then stop receiving. Unregister the MCTP network device and release the memory space of the network device. 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 on the target adapter.

[0101] The above method realizes dynamic configuration of MCTP communication links, including adding MCTP communication links and removing MCTP communication links, which solves the problem that the prior art cannot dynamically configure MCTP communication links.

[0102] It is worth noting that the solution provided in the embodiment of the present application is embedded in the I2C subsystem, is compatible with the existing technical solution for configuring the MCTP communication link through DTS, is universal and portable, and provides a quick and easy method for the development of application layer functions.

[0103] Based on the same inventive concept, the present application also provides a communication link configuration device for dynamically adding or removing MCTP communication links, solving the problem that the prior art cannot dynamically configure MCTP communication links, see Figure 4 , the device comprises:

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

[0105] The judgment module 402 judges whether the successfully matched command word is the first command word or the second command word if the input character string matches the preset command word successfully;

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

[0107] The removal module 404 removes the MCTP communication link of the MCTP device instance.

[0108] In a possible design, the removal module 404 is specifically used to: terminate the sending thread on the MCTP device instance; when the data currently transmitted on the sending thread is completely received, deregister the MCTP device instance; 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 a possible design, the device is further used 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 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 turned on, traverse the MCTP server-side device list to determine the list head of the target adapter; establish an MCTP device instance corresponding to the list head of the target adapter, 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 in an open state.

[0110] In a possible design, the device is further used to: read the value of the custom member in the target adapter structure based on the 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 further used to: if the target string is not the second command word, end the operation; or, if the target string is the second command word but the MCTP communication link of the root adapter is not enabled, end the operation.

[0112] In a possible design, the apparatus is further used 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 MCTP communication link of the adapter; set a read operation function and a write operation function of 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, an electronic device is also provided in an embodiment of the present application, and the electronic device can implement the function of the configuration device of the aforementioned communication link, referring to Figure 5 , the electronic device comprises:

[0114] At least one processor 501, and a memory 502 connected to the at least one processor 501. The specific connection medium between the processor 501 and the memory 502 is not limited in the embodiment of the present application. Figure 5 In the example, the processor 501 and the memory 502 are connected via a bus 500. The bus 500 is Figure 5 The connections between other components are shown in bold lines, and are not intended to be limiting. The bus 500 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. Alternatively, the processor 501 can also be called a controller, and there is no limitation on the name.

[0115] In the embodiment of the present application, the memory 502 stores instructions that can be executed by at least one processor 501. The at least one processor 501 can execute the communication link configuration method discussed above by executing the instructions stored in the memory 502. The processor 501 can implement Figure 4 The functions of each module in the device shown.

[0116] Among them, the processor 501 is the control center of the device, and can use various interfaces and lines to connect the various parts of the entire control device. By running or executing instructions stored in the memory 502 and calling data stored in the memory 502, the various functions of the device and processing data, the device can be monitored as a whole.

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

[0118] Processor 501 can be a general-purpose processor, such as a central processing unit (CPU), a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component, and can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application. A general-purpose processor can be a microprocessor or any conventional processor, etc. The steps of the configuration method of the communication link disclosed in the embodiments of the present application can be directly embodied as a hardware processor to be executed, or a combination of hardware and software modules in the processor can be executed.

[0119] The memory 502 is a non-volatile computer-readable storage medium that can be used to store non-volatile software programs, non-volatile computer executable programs and modules. The memory 502 may include at least one type of storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory, a random access memory (Random Access Memory, RAM), a static random access memory (Static Random Access Memory, SRAM), a programmable read-only memory (Programmable Read Only Memory, PROM), a read-only memory (Read Only Memory, ROM), an electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic memory, a disk, an optical disk, etc. The memory 502 is any other medium that can be used to carry or store a desired program code in the form of an instruction or data structure and can be accessed by a computer, but is not limited thereto. The memory 502 in the embodiment of the present application can also be a circuit or any other device that can realize a storage function, 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 above embodiment can be fixed into the chip, so that the chip can execute the code when running. Figure 1The steps of the communication link configuration method of the embodiment shown are as follows: How to design and program the processor 501 is a technology well known to those skilled in the art and will not be described in detail here.

[0121] Based on the same inventive concept, an embodiment of the present application further provides a storage medium, which stores computer instructions. When the computer instructions are executed on a computer, the computer executes the configuration method of the communication link discussed above.

[0122] In some possible implementations, various aspects of the communication link configuration method provided in the present application may also be implemented in the form of a program product, which includes program code. When the program product is run on an apparatus, the program code is used to enable the control device to execute the steps of the communication link configuration method according to various exemplary embodiments of the present application described above in this specification.

[0123] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.

[0124] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0125] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0126] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0127] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for configuring a communication link, characterized in that: The method comprises: Obtaining an input string, and matching the input string with a preset command word; If the input character string successfully matches the preset command word, determining whether the successfully matched command word is the first command word or the second command word; When the command word is the first command word, traverse the MCTP server device linked list to determine the MCTP device instance corresponding to the linked list head of the target adapter, wherein the target adapter is the adapter specified by the input string; Remove the MCTP communication link of the MCTP device instance.

2. The method according to claim 1, characterized in that The removing the MCTP communication link of the MCTP device instance includes: terminating the send thread on the MCTP device instance; When the data currently transmitted on the sending thread is completely received, deregistering the MCTP device instance; 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.

3. The method according to claim 1, characterized in that The method further comprises: When the command word is the second command word, acquiring the target adapter and the root adapter to which the target adapter is attached; Determine whether the target character string is the second command word, wherein the target character string is obtained by converting the value of the custom member in the target adapter structure; If the target character string is the second command word and the MCTP communication link of the root adapter is enabled, traverse the MCTP server device linked list to determine the linked list head of the target adapter; Establishing an MCTP device instance corresponding to the linked list header of the target adapter and configuring 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 in an open state.

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

5. The method according to claim 3, characterized in that After determining whether the target character string is the second command word, the method further includes: If the target character string is not the second command word, then the operation ends; or, If the target character string is the second command word, but the MCTP communication link of the root adapter is not enabled, the operation is terminated.

6. The method according to claim 1, characterized in that 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 state of the MCTP communication link of the adapter; A read operation function and a write operation function of the mctp attribute are set, 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.

7. A communication link configuration device, characterized in that: The system comprises: A matching module, which obtains an input string and matches the input string with a preset command word; A judgment module, if the input character string matches the preset command word successfully, judges that the command word that matches successfully is the first command word or the second command word; a determination module, when the preset command word is the first command word, traversing the MCTP server device linked list to determine the MCTP device instance corresponding to the linked list head of the target adapter, wherein the target adapter is the adapter specified by the input string; A removal module removes the MCTP communication link of the MCTP device instance.

8. The device according to claim 7, characterized in that The removal module is specifically used for: terminating the send thread on the MCTP device instance; When the data currently transmitted on the sending thread is completely received, deregistering the MCTP device instance; 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.

9. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, configured to implement the method steps of any one of claims 1 to 6 when executing the computer program stored in the memory.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Method for monitoring network card equipment, baseboard management controller and network card equipment

    CN110958132A

  • Equipment management method and device, electronic equipment and readable storage medium

    CN112764818A

  • Message receiving method and system in solid state disk and related device

    CN112887227A

  • Hot plug method, PCIE device and management controller

    CN117194299A

  • Altering networking switch priority responsive to compute node fitness

    US10715411B1