Control data interaction method and device, computer program product, equipment and medium
By parsing the submission queue entries in the NVMe protocol, identifying the operation command type, and obtaining data range indication information, the precise transmission of target data is achieved, solving the problem of low data interaction efficiency in the NVMe protocol and improving the utilization of link bandwidth and memory resources.
Patent Information
- Application Number
- CN202510503581.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-22
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2045-04-22
AI Technical Summary
In the NVMe protocol, some commands need to transmit a fixed amount of structured data, but the host usually only focuses on a few fields, resulting in a waste of underlying link bandwidth and host memory resources. Especially in embedded scenarios, frequent data transmissions severely consume link bandwidth and memory resources, leading to low data interaction efficiency.
By parsing the fields of the submission queue entries issued by the host, the operation command type is identified and the data range indication information is obtained. The range of target data in the control data is precisely defined, and the accurate transmission of target data between the storage device and the host is achieved, optimizing memory resource configuration and link bandwidth utilization.
It significantly improves the efficiency of data interaction between storage devices and the host, reduces redundant data transmission, increases the utilization of link bandwidth and memory resources, and optimizes the data interaction process.
Smart Images

Figure CN120029963B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a control data interaction method and device, computer program product, equipment and medium. BACKGROUND
[0002] NVMe (Non-Volatile Memory Express, Non-Volatile Memory Host Controller Interface Specification) storage device supports two types of commands: Admin control command (Administrative Commands) and IO command (Input / Output Commands, Input / Output Commands), the former is used for device control, and the latter is used for user data access. Figure 1 is an example of host and NVMe storage device communication, some Admin control commands can complete the control of the device through the interaction of SQE (Submission Queue Entry, Submission Queue Entry) and CQE (Completion Queue Entry, Completion Queue Entry). Some Admin control commands need to transmit control data in addition to SQE and CQE, specifically, see Figure 2 , Figure 2 is a host, storage device and controller data interaction flowchart, the host applies for a fixed size of space in the memory according to the command type, and fills the physical region page field with the memory first address, then puts the SQE into the submission queue; the NVMe device reads the SQE, carries the specified size of control data through direct memory access, generates a completion queue entry after completion and interrupts the host.
[0003] In the NVMe protocol, some commands need to transmit fixed-size structured data, but the host usually only pays attention to a few fields, resulting in double waste of underlying link bandwidth resources and host memory resources. Especially in the embedded scenario, the host needs to interact with multiple storage devices at the same time, and single concurrent interaction not only needs to apply for a large amount of memory, but also in the process of frequent data transmission, a large amount of redundant data seriously occupies the link bandwidth, resulting in extremely low data interaction efficiency between the storage device and the host. SUMMARY
[0004] Therefore, the purpose of the present application is to provide a control data interaction method, device, computer program product, equipment and medium, which can improve the utilization rate of the underlying link bandwidth, ensure that the size of the allocated memory is consistent with the actual amount of transmitted data, and improve the data interaction efficiency between the storage device and the host. The specific scheme is as follows:
[0005] In a first aspect, the present application discloses a control data interaction method applied to a storage device, comprising:
[0006] parsing a first field of the submission queue item issued by the host to determine an operation command type;
[0007] when the operation command type is a control command, parsing a second field of the submission queue item to obtain data range indication information; wherein the data range indication information indicates range information of target data in control data, and the control data is a data set for assisting completion of the control command;
[0008] executing the control command according to the data range indication information to realize transmission of the target data between the storage device and the target memory of the host, and generating an execution result; wherein the target memory is obtained by the host based on the data range indication information in advance;
[0009] returning a completion queue item containing the execution result to the host.
[0010] Optionally, the second field includes a transmission mode field and an address range field, and the data range indication information includes a transmission mode parameter and an address range parameter; wherein the transmission mode field corresponds to the transmission mode parameter, and the address range field corresponds to the address range parameter.
[0011] Optionally, the transmission mode parameter includes full transmission or partial transmission, and the address range parameter includes offset information and length information.
[0012] Optionally, executing the control command according to the data range indication information to realize transmission of the target data between the storage device and the target memory of the host includes:
[0013] if the transmission mode parameter in the data range indication information is full transmission, determining all contents of the control data as the target data, and executing the control command to realize transmission of the target data between the storage device and the target memory of the host.
[0014] Optionally, executing the control command according to the data range indication information to realize transmission of the target data between the storage device and the target memory of the host includes:
[0015] if the transmission mode parameter in the data range indication information is partial transmission, determining a start position of the target data according to the offset information in the address range parameter, and determining an end position of the target data according to the length information in the address range parameter;
[0016] determining the target data from the control data according to the start position and the end position, and executing the control command to realize transmission of the target data between the storage device and the target memory of the host.
[0017] Optionally, the control data interaction method further includes:
[0018] If the value of the transmission mode field is the first value, it is determined that the transmission mode parameter is full transmission, and if the value of the transmission mode field is the second value, it is determined that the transmission mode parameter is partial transmission.
[0019] Optionally, the control data interaction method further comprises:
[0020] The first value is configured as 0 and the second value is configured as 1 based on a non-volatile memory host controller interface specification protocol.
[0021] Optionally, when the value of the transmission mode field is the first value, the target memory is a static allocation size defined based on the non-volatile memory host controller interface specification protocol, and when the value of the transmission mode field is the second value, the target memory is a dynamic allocation size obtained based on the address range parameter.
[0022] Optionally, the control command is executed according to the data range indication information to realize the transmission of the target data between the storage device and the target memory of the host, comprising:
[0023] When the control command represents that the storage device transmits data to the host, the target data is determined from the locally stored control data according to the data range indication information;
[0024] The target data is transmitted to the target memory of the host.
[0025] Optionally, when the control command represents that the storage device transmits data to the host, the control command comprises a state feedback command and a data reporting command; wherein the state feedback command is used to provide state information of the storage device, and the data reporting command is used to transmit operation data of the storage device.
[0026] Optionally, the control command is executed according to the data range indication information to realize the transmission of the target data between the storage device and the target memory of the host, comprising:
[0027] When the control command represents that the host transmits data to the storage device, the target data is determined from the control data of the target memory according to the data range indication information;
[0028] The target data is transmitted to a preset storage area of the storage device.
[0029] Optionally, when the control command represents that the host transmits data to the storage device, the control command comprises a state management command and a parameter configuration command; wherein the state management command is used to regulate the working state of the storage device, and the parameter configuration command is used to set the functional parameters of the storage device.
[0030] Optionally, the storage device comprises a disk array card and a plurality of solid state disks hung to the disk array card.
[0031] Optionally, the control data interaction method further comprises:
[0032] When multiple control commands exist simultaneously, a priority score of each control command is determined based on an operation urgency of each control command and a data timeliness;
[0033] An actual execution order of the control commands is determined according to an initial order of the submission queue entries in the submission queue and the priority scores of the control commands.
[0034] In a second aspect, the present application discloses a control data interaction method applied to a host, comprising:
[0035] generating a submission queue entry; wherein a first field of the submission queue entry contains an operation command type, and when the operation command type is a control command, a second field of the submission queue entry contains data range indication information, the data range indication information indicating range information of target data in control data, the control data being a data set for assisting completion of the control command;
[0036] pre-allocating a target memory based on the data range indication information;
[0037] issuing the submission queue entry to a storage device, so that the storage device executes the control command according to the data range indication information, realizes transmission of the target data between the storage device and the target memory of the host, and generates an execution result;
[0038] receiving a completion queue entry returned by the storage device and containing the execution result.
[0039] In a third aspect, the present application discloses a control data interaction device applied to a storage device, comprising:
[0040] a field analysis module configured to analyze a first field of a submission queue entry issued by a host, so as to determine an operation command type;
[0041] a range determination module configured to, when the operation command type is a control command, analyze a second field of the submission queue entry, so as to obtain data range indication information; wherein the data range indication information indicates range information of target data in control data, and the control data is a data set for assisting completion of the control command;
[0042] a command execution module configured to execute the control command according to the data range indication information, realize transmission of the target data between the storage device and a target memory of the host, and generate an execution result; wherein the target memory is pre-allocated by the host based on the data range indication information;
[0043] a result return module configured to return a completion queue entry containing the execution result to the host.
[0044] In a fourth aspect, the present application discloses a control data interaction device applied to a host, comprising:
[0045] An entry generation module is configured to generate a submission queue entry; wherein a first field of the submission queue entry contains an operation command type, and when the operation command type is a control command, a second field of the submission queue entry contains data range indication information, which indicates range information of target data in control data, and the control data is a data set for assisting in completing the control command.
[0046] A memory allocation module is configured to pre-allocate a target memory based on the data range indication information.
[0047] An entry issuing module is configured to issue the submission queue entry to a storage device, so that the storage device executes the control command according to the data range indication information, realizes the transmission of the target data between the storage device and the target memory of the host, and generates an execution result.
[0048] A result receiving module is configured to receive a completion queue entry returned by the storage device and containing the execution result.
[0049] In a fifth aspect, the present application discloses a computer program product, comprising computer programs / instructions, which, when executed by a processor, realize the steps of the control data interaction method.
[0050] In a sixth aspect, the present application discloses an electronic device, comprising:
[0051] A memory is configured to save computer programs.
[0052] A processor is configured to execute the computer programs to realize the control data interaction method disclosed above.
[0053] In a seventh aspect, the present application discloses a computer readable storage medium, configured to save computer programs; wherein the computer programs, when executed by a processor, realize the control data interaction method disclosed above.
[0054] It can be seen that the present application proposes a control data interaction method applied to a storage device, comprising: analyzing a first field of a submission queue entry issued by a host to determine an operation command type; when the operation command type is a control command, analyzing a second field of the submission queue entry to obtain data range indication information; wherein the data range indication information indicates range information of target data in control data, and the control data is a data set for assisting in completing the control command; executing the control command according to the data range indication information, realizing the transmission of the target data between the storage device and a target memory of the host, and generating an execution result; wherein the target memory is pre-allocated by the host based on the data range indication information; and returning a completion queue entry containing the execution result to the host.
[0055] Beneficial effects: In the control data interaction method proposed in the present application, the storage device first parses the first field of the submission queue item issued by the host to determine the operation command type. When the command is identified as a control command, the second field is further parsed to obtain data range indication information. The data range indication information accurately defines the location and range of the target data in the control data set, enabling the host to pre-allocate a target memory with an accurate size match based on this information. Subsequently, the storage device implements accurate transmission of the target data between the storage device and the target memory pre-allocated by the host according to the data range indication information, and generates the corresponding execution result after completing the transmission. That is, the host will embed data range indication information when constructing the control command, and accordingly apply for a target memory with a size matching the data range indication information. After receiving the command, the storage device can accurately locate the target data in the control data that the host actually needs by parsing the data range indication information, and implement transmission of the target data between the storage device and the target memory of the host. Compared with the scheme in the prior art that requires transmission of complete data structures and allocation of fixed large memory, the present application only transmits the target data actually concerned by the host through the accurate data range indication mechanism, not only significantly improving the utilization rate of the underlying link bandwidth, but also realizing optimized allocation of memory resources, significantly improving the data interaction efficiency between the storage device and the host. BRIEF DESCRIPTION OF DRAWINGS
[0056] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced below. Obviously, the drawings in the following description are only embodiments of the present application, and those skilled in the art can obtain other drawings according to the provided drawings without creative labor.
[0057] Figure 1 An interaction architecture diagram of a host and a controller of an NVMe storage device;
[0058] Figure 2 A data interaction flowchart of a host, a storage device and a controller;
[0059] Figure 3 A control data interaction method flowchart for the device side disclosed in the present application;
[0060] Figure 4 An address range field structure diagram disclosed in the present application;
[0061] Figure 5 A specific control data interaction method flowchart for the device side disclosed in the present application;
[0062] Figure 6 Another specific control data interaction method flow for the device side disclosed in the present application;
[0063] Figure 7 An interaction schematic diagram of data transmission between a host and an NVMe device disclosed in the present application;
[0064] Figure 8 An interaction schematic diagram of data transmission between a traditional host and an NVMe device;
[0065] Figure 9 A control data interaction method flowchart for the host side disclosed in the present application;
[0066] Figure 10 An apparatus structure schematic diagram for the control data interaction on the device side disclosed in the present application;
[0067] Figure 11 An apparatus structure schematic diagram for the control data interaction on the host side disclosed in the present application;
[0068] Figure 12 An electronic device structure diagram disclosed in the present application. DETAILED DESCRIPTION
[0069] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present application.
[0070] In the NVMe protocol, some commands need to transmit structured data of a fixed size, but the host usually only focuses on a few fields, resulting in double waste of underlying link bandwidth resources and host memory resources. Especially in the embedded scenario, the host needs to interact with multiple storage devices at the same time, and single concurrent interaction not only needs to apply a large amount of memory, but also in the frequent data transmission process, a large amount of redundant data seriously occupies the link bandwidth, resulting in extremely low data interaction efficiency between the storage device and the host.
[0071] Therefore, the embodiments of the present application propose a control data interaction scheme, which can improve the utilization rate of the underlying link bandwidth, ensure that the size of the allocated memory is consistent with the actual amount of transmitted data, and improve the data interaction efficiency between the storage device and the host.
[0072] The embodiments of the present application disclose a control data interaction method, referring to Figure 3 The method comprises the following steps:
[0073] Step S11: Analyze the first field of the submission queue item issued by the host to determine the operation command type.
[0074] In this embodiment, the submission queue item issued by the host contains multiple fields. Among them, the first field is used to identify the type of operation command. By analyzing the first field, the storage device can identify the type of operation command requested by the host this time. The type of operation command is divided into IO command and control command. IO command is used to perform input and output operation, such as reading disk data or writing file content, etc. Control command is used to configure and manage the storage device, such as setting the working mode of the device or adjusting the parameters of the device, etc.
[0075] Step S12: When the operation command type is control command, analyze the second field of the submission queue item to obtain data range indication information; wherein the data range indication information represents the range information of the target data in the control data, and the control data is a data set for assisting the completion of the control command.
[0076] In this embodiment, when the operation command type is control command, the second field of the submission queue item is analyzed to obtain data range indication information, wherein the data range indication information represents the range information of the target data in the control data. Specifically, the second field includes a transmission mode field and an address range field, and the data range indication information includes a transmission mode parameter and an address range parameter; the transmission mode field corresponds to the transmission mode parameter, and the address range field corresponds to the address range parameter. The transmission mode parameter includes full transmission or partial transmission, and the address range parameter includes offset information and length information. Figure 4 The address range field in NVMe is shown in the figure. The field is 8 bits, which is divided into two parts: offset (offset): occupies the high 5 bits (3-7 bits), which represents the offset of the control data. Its unit is 128 bytes, and the actual offset is equal to the value of offset multiplied by 128. For example, if the offset value is 3, the offset is 3x128=384 bytes. length (length): occupies the low 3 bits (0-2 bits), which represents how many bytes are obtained starting from the offset specified offset. The number of bytes obtained is equal to 2 raised to the power of length. For example, if length is 2, the number of transmission bytes is bytes; if length is 7, the number of transmission bytes is Bytes. It is worth noting that, since the offset field is represented by 5 bits, its value range determines that it can index to 3968 at most. The length field is represented by 3 bits, and its maximum value is 7 (corresponding to binary 111), which can transmit 128 bytes. The offset index range plus the maximum transmittable byte number of the length field is just enough to completely cover the size of the control command data 4096 bytes, ensuring effective positioning and transmission of the control command data.
[0077] In this embodiment, the control data is a structured data set that assists in completing the control command. Among them, structured means that the data is organized according to specific rules and formats, which is convenient for storage, reading and parsing. For example, in the control command of setting the working mode of the device, the control data contains specific mode configuration information in a structured form, such as specific parameter codes corresponding to different working modes, and each parameter is arranged in a fixed order and data type; in the control command of starting / stopping the service, the control data carries the related identification (such as unique number, name code, etc.) and operation parameters (start / stop condition, priority, etc.) of the service in a structured manner; in the control command of querying the running state of the device, the control data contains real-time temperature, read / write error count (classified by error type) and remaining available storage space (measured in bytes or specific capacity units) of the device in a structured manner; in the control command of obtaining device performance statistics, the control data carries parameters such as read / write throughput per unit time (distinguished by read / write throughput), average response time (accurate to a specified time precision), and I / O operation times (subdivided by operation type) in a structured manner.
[0078] Step S13: executing the control command according to the data range indication information, realizing the transmission of the target data between the storage device and the target memory of the host, and generating an execution result; wherein the target memory is pre-allocated by the host based on the data range indication information.
[0079] In this embodiment, the control command is executed according to the data range indication information, realizing the transmission of the target data between the storage device and the target memory of the host, and generating an execution result; wherein the target memory is pre-allocated by the host based on the data range indication information. That is, the host will embed the data range indication information when constructing the control command, and apply for a target memory whose size matches the data range indication information accordingly. After receiving the command, the storage device can accurately locate the target data actually needed by the host in the control data by analyzing the data range indication information, and realize the transmission of the target data between the storage device and the target memory of the host. In this way, through the accurate data range indication mechanism, only the target data actually concerned by the host is transmitted, which not only significantly improves the utilization rate of the underlying link bandwidth, but also realizes the optimized allocation of memory resources, and significantly improves the data interaction efficiency between the storage device and the host.
[0080] In a specific embodiment, when the control command represents that the storage device transmits data to the host, the target data is determined from the locally stored control data according to the data range indication information, and the target data is transmitted to the target memory of the host. Specifically, when the control command represents that the storage device transmits data to the host, the control command includes a state feedback command and a data reporting command; wherein the state feedback command is used to provide the state information of the storage device, and the data reporting command is used to transmit the running data of the storage device.
[0081] For example, the host periodically sends a state feedback command to the storage device to understand the health status of a certain hard disk in the array. The storage device accurately locates the number of bad tracks, power-on time, temperature and other key state information of the hard disk from the locally stored control data as target data according to the data range indication information, and transmits it to the target memory specified by the host. The host sends a data reporting command to the storage device to request the storage device to report the read-write access frequency of the files under a specific folder. The storage device extracts the relevant running data as target data from the control data according to the data range indication information, and transmits it to the target memory. In this way, the storage device accurately transmits target data on demand, reduces the amount of invalid data transmission, avoids irrelevant data occupying the host memory, and improves the data interaction efficiency.
[0082] In another specific embodiment, when the control command represents that the host transmits data to the storage device, the target data is determined from the control data of the target memory according to the data range indication information, and the target data is transmitted to the preset storage area of the storage device. When the control command represents that the host transmits data to the storage device, the control command includes a state management command and a parameter configuration command; wherein the state management command is used to regulate the working state of the storage device, and the parameter configuration command is used to set the functional parameters of the storage device.
[0083] For example, in the state management command scenario, when the load of the storage cluster in the data center is unbalanced, the host sends a state management command to a storage device with too high load. The host determines the control parameters such as adjusting the cache allocation ratio as target data from the target memory according to the data range indication information, and transmits it to the preset storage area of the storage device. In the parameter configuration command scenario, when the enterprise needs to enable the hierarchical storage function of the storage device, the host sends a parameter configuration command, finds the strategy parameters (such as hot data storage level, cold data migration threshold, etc.) of hierarchical storage as target data from the target memory, and transmits it to the storage device. In this way, the host accurately transmits target data to the storage device on demand, reduces the amount of invalid data transmission, avoids irrelevant data occupying the memory of the storage device, and improves the data interaction efficiency.
[0084] Step S14: return the completion queue entry containing the execution result to the host.
[0085] In the embodiment, when the storage device successfully executes the control command, a completion queue entry containing the execution result is generated. The completion queue entry records the execution result of the control command, such as a status identifier of whether the command execution is successful, an error code generated in the execution process (if the execution fails), and other related data. After the completion queue entry is generated, the storage device returns the completion queue entry to the host through a predetermined communication link. After receiving the completion queue entry, the host performs subsequent processing according to the information in the completion queue entry. For example, if the status identifier is successful, the host continues to issue other related commands to further operate the storage device; if the status identifier is failed, the host starts a corresponding fault processing procedure according to the error code, notifies an administrator, or attempts to resend the command, and the like.
[0086] In addition, the storage device in the embodiment includes a redundant array of independent disks (RAID) card and a plurality of solid state disks (SSD) connected to the RAID card. Since the application can accurately transmit target data to the storage device on demand, it avoids irrelevant data occupying the memory of the storage device, and thus enables the RAID card to concurrently control a plurality of connected SSDs with limited memory space, accelerates the response speed of the RAID card, and improves the operation efficiency of the device.
[0087] In addition, when a plurality of control commands exist at the same time, the priority score of each control command is determined based on the operation urgency and the data timeliness of each control command, and the actual execution order of each control command is determined according to the initial order of the submission queue entry of the control command in the submission queue and the priority score of the control command. For example, the operation urgency can be divided into three levels: high (such as device fault recovery and critical configuration update), medium (such as periodic status query), and low (such as log collection). The urgency score corresponding to the high operation urgency command is 3, the urgency score corresponding to the medium operation urgency command is 1, and the urgency score corresponding to the low operation urgency command is 0. Further, the data timeliness includes high real-time requirement and low real-time requirement. For data with high real-time requirement, the data timeliness coefficient is 3, and for data with low real-time requirement, the data timeliness coefficient is 1. Further, the priority score = urgency score × data timeliness coefficient. The initial order is adjusted according to the calculated priority score, so that the storage device can preferentially process high-priority commands, thereby improving the data processing efficiency.
[0088] Based on the above, the application discards the traditional way of fixed control data transmission each time. The host can specify the transmission of a specific part of the control data on demand. In this way, the application can effectively reduce the amount of redundant data transmission on the link between the host and the storage device, while avoiding occupying too much host memory for transmitting unnecessary data, and realizing efficient use of link bandwidth and host memory resources.
[0089] It can be seen that the application provides a control data interaction method applied to a storage device, including: parsing a first field of a submission queue item issued by a host to determine an operation command type; when the operation command type is a control command, parsing a second field of the submission queue item to obtain data range indication information; wherein the data range indication information represents range information of target data in control data, and the control data is a data set for assisting completion of the control command; executing the control command according to the data range indication information to realize transmission of the target data between the storage device and a target memory of the host, and generating an execution result; wherein the target memory is obtained by the host based on the data range indication information in advance; and returning a completion queue item containing the execution result to the host.
[0090] Beneficial effects: In the control data interaction method provided by the application, the storage device first parses the first field of the submission queue item issued by the host to determine the operation command type. When it is identified that the command is a control command, the second field is further parsed to obtain the data range indication information. The data range indication information accurately defines the position and range of the target data in the control data set, so that the host can pre-allocate a target memory with a size that accurately matches the data range indication information. Subsequently, the storage device realizes accurate transmission of the target data between the storage device and the target memory pre-allocated by the host according to the data range indication information, and generates the corresponding execution result after completing the transmission. That is, the host will embed the data range indication information when constructing the control command, and allocate a target memory with a size that matches the data range indication information. After receiving the command, the storage device can accurately locate the target data in the control data that the host actually needs by parsing the data range indication information, and realize transmission of the target data between the storage device and the target memory of the host. Compared with the scheme in the prior art that needs to transmit a complete data structure and allocate a fixed large memory, the application only transmits the target data that the host actually concerns through the accurate data range indication mechanism, which not only significantly improves the utilization rate of the underlying link bandwidth, but also realizes optimized allocation of memory resources, and significantly improves the data interaction efficiency between the storage device and the host.
[0091] In this embodiment, CW0 (Command Data Word 0), CDW2, CDW3, CDW4, and CDW5 are reserved fields of the SQE, and CW0 occupies 0-3 bytes, and CDW2-CDW5 occupy 8-23 bytes. CW0 is used as a transmission mode field in the second field, indicating whether full data or partial data is transmitted, and CDW2-CDW5 are used as an address range field in the second field. After the NVMe device receives the SQE, CDW0 is read. If the value of CDW0 is a first value, it indicates that full control data is transmitted. If the value of CDW0 is a second value, it indicates that partial control data is transmitted, and CDW2-CDW5 are read. Then, data range indication information is obtained according to the encoding of each byte of CDW2-CDW5, and target data is obtained from the full control data. Details are as follows:
[0092] The embodiment of the present application discloses a specific control data interaction method. Compared with the previous embodiment, the technical solution is further described and optimized. Referring to Figure 5 as shown, specifically comprising:
[0093] Step S13a: If the transmission mode parameter in the data range indication information is full transmission, the entire content of the control data is determined as the target data, and the control command is executed to realize the transmission of the target data between the storage device and the target memory of the host.
[0094] In this embodiment, if the transmission mode parameter in the data range indication information is full transmission, the entire content of the control data is determined as the target data, and the control command is executed to realize the transmission of the target data between the storage device and the target memory of the host. Specifically, based on the Non-Volatile Memory Host Controller Interface Specification protocol, the first value is configured as 0, that is, if the value of CDW0 is 0, the entire content of the control data is determined as the target data. In addition, if the value of CDW0 is 0, the target memory is a static allocation size defined based on the Non-Volatile Memory Host Controller Interface Specification protocol, that is, the target memory is applied according to the complete size of the control data defined by the NVMe protocol. And execute the control command to read the full control data from the host memory, or write the full control data to the host memory.
[0095] The embodiment of the present application discloses a specific control data interaction method. Compared with the previous embodiment, the technical solution is further described and optimized. Referring to Figure 6 as shown, specifically comprising:
[0096] Step S13b1: If the transmission mode parameter in the data range indication information is partial transmission, the starting position of the target data is determined according to the offset information in the address range parameter, and the ending position of the target data is determined according to the length information in the address range parameter.
[0097] Step S13b2: The target data is determined from the control data according to the starting position and the ending position, and the control command is executed to realize the transmission of the target data between the storage device and the target memory of the host.
[0098] In this embodiment, if the transmission mode parameter in the data range indication information is partial transmission, the starting position of the target data is determined according to the offset information in the address range parameter, and the ending position of the target data is determined according to the length information in the address range parameter. Further, the target data is determined from the control data according to the starting position and the ending position, and the control command is executed to realize the transmission of the target data between the storage device and the target memory of the host. Specifically, based on the Non-Volatile Memory Host Controller Interface Specification protocol, the second value is configured as 1, so that if the value of CDW0 is 1, each byte in CDW2, CDW3, CDW4 and CDW5 is parsed to obtain the data range indication information, and the target data is read out from the host memory or written into the host memory according to the offset information and the length information indicated thereby. In addition, if the value of CDW0 is 1, the target memory is a dynamically allocated size obtained based on the address range parameter. In this way, the optimization of memory resources is realized.
[0099] Figure 7 Fig. 1 is an interaction schematic diagram of a host and an NVMe device for transmitting data disclosed in the present application, Figure 8 Fig. 2 is an interaction schematic diagram of a traditional host and an NVMe device for transmitting data.
[0100] In a conventional scheme, the total amount of control data of an NVMe device is 4096 bytes, which is divided into multiple fields such as field0 to field4095. Each of these fields carries specific information, for example, the management instruction set of the storage device. Different fields can correspond to configuration parameters, status identifiers, operation commands, and other contents of the device. When the host only needs to use the data of field1 and field4095, according to the conventional NVMe protocol rules, 4096 bytes of memory space still needs to be applied. This is because the conventional protocol stipulates that data is transmitted and stored in a fixed size, and even if only part of the field data is actually needed, memory needs to be reserved for the full amount of data. In addition, in terms of link transmission, 4096 bytes of data also needs to be transmitted between the host and the NVMe device. This mechanism has many drawbacks. On the one hand, a large amount of unused data occupies memory space, reducing memory utilization, especially in embedded systems or multi-task concurrent scenarios where memory resources are limited, which can reduce the allocatable memory of other programs and affect the overall performance of the system. On the other hand, in the case of limited link bandwidth, transmitting redundant data can occupy valuable bandwidth resources, increase data transmission delay, reduce data transmission efficiency, and cause the system response time to become longer.
[0101] In the scheme of the present application, when the host only uses field1 and field4095, since the data amount of these two fields is only 2 bytes, the host only needs to apply 2 bytes of memory as needed. This strategy effectively avoids memory waste, improves the utilization efficiency of memory resources, enables the host to more reasonably allocate memory to different tasks, and enhances the performance of the system when processing multiple tasks. In terms of link transmission, the present application only transmits 2 bytes of actual required data. Compared with the conventional scheme, the amount of data transmission is greatly reduced, and the link load is reduced. Specifically, by allocating memory as needed and accurately transmitting data, the present application effectively solves the problems of memory waste and low link bandwidth utilization in the conventional scheme, improves the efficiency of data interaction between the host and the NVMe device, and further optimizes the performance of the entire storage system.
[0102] Further, the present application proposes to construct an intelligent data range prediction mechanism on the host side. By means of machine learning algorithm, the historical data interaction records are deeply analyzed. Specifically, the mechanism learns the usage patterns of the host for control data under different operation scenarios and at different time points. For example, during the daily business peak period, the host may frequently request data of certain specific fields for business processing; while during the off-peak period, the requested data fields may be different. Through the learning of these patterns, the mechanism can predict the data range that the host may need in advance before the host initiates a control command.
[0103] Correspondingly, the present application also discloses a control data interaction method applied to a host, as shown inFigure 9 As shown in the figure, the method comprises:
[0104] Step S21: generating a submission queue entry; wherein a first field of the submission queue entry contains an operation command type, and when the operation command type is a control command, a second field of the submission queue entry contains data range indication information, the data range indication information indicating range information of target data in control data, the control data being a data set for assisting completion of the control command.
[0105] Step S22: pre-allocating target memory based on the data range indication information.
[0106] Step S23: issuing the submission queue entry to a storage device, so that the storage device executes the control command according to the data range indication information, realizes transmission of the target data between the storage device and the target memory of the host, and generates an execution result.
[0107] Step S24: receiving a completion queue entry returned by the storage device and containing the execution result.
[0108] The embodiment discloses a control data interaction method applied to a host. The method first generates a submission queue entry, and when the operation command type is a control command, a second field in the entry contains information indicating the range of target data in control data. Then, target memory is pre-allocated based on the data range indication information, and subsequently, the submission queue entry is issued to a storage device, so that the storage device executes the control command according to the data range indication, realizes transmission of the target data between the storage device and the target memory of the host, and generates an execution result. Finally, the host receives a completion queue entry returned by the storage device and containing the execution result.
[0109] In this way, by specifying data range indication information by the host, pre-allocating target memory based on the data range indication information, and placing the data range indication information in the second field of the submission queue entry when the operation command type is a control command, the submission queue entry containing the data range indication information is subsequently issued to the storage device. The storage device executes the control command according to the information, realizes transmission of the target data between the local and the target memory of the host, and in this process, the host avoids unnecessary data transmission by accurately specifying the data range, significantly improves the utilization rate of the underlying link bandwidth, optimizes the configuration of the memory resources of the host itself, and improves the data interaction efficiency between the storage device and the host.
[0110] Correspondingly, the embodiment of the application also discloses a control data interaction device applied to a storage device, as shown in the figure. Figure 10 As shown in the figure, the device comprises:
[0111] The field analysis module 11 is configured to analyze a first field of a submission queue entry issued by the host, so as to determine an operation command type.
[0112] a range determining module 12, configured to parse the second field of the submission queue entry to obtain data range indication information when the operation command type is a control command; the data range indication information indicates range information of target data in control data, and the control data is a data set for assisting in completing the control command;
[0113] a command executing module 13, configured to execute the control command according to the data range indication information, to realize transmission of the target data between the storage device and the target memory of the host, and to generate an execution result; the target memory is obtained by the host based on the data range indication information in advance;
[0114] a result returning module 14, configured to return a completion queue entry containing the execution result to the host.
[0115] The more specific working processes of the above modules can refer to the corresponding content disclosed in the foregoing embodiments, and will not be described here.
[0116] It can be seen that the application provides a control data interaction device applied to a storage device, which includes: a field analyzing module 11, configured to analyze a first field of a submission queue entry issued by a host to determine an operation command type; a range determining module 12, configured to parse a second field of the submission queue entry to obtain data range indication information when the operation command type is a control command; the data range indication information indicates range information of target data in control data, and the control data is a data set for assisting in completing the control command; a command executing module 13, configured to execute the control command according to the data range indication information, to realize transmission of the target data between the storage device and a target memory of the host, and to generate an execution result; the target memory is obtained by the host based on the data range indication information in advance; and a result returning module 14, configured to return a completion queue entry containing the execution result to the host.
[0117] Beneficial effects: in the control data interaction method proposed in the application, the storage device first parses the first field of the submission queue item issued by the host to determine the operation command type. When it is identified that the command is a control command, the second field is further parsed to obtain data range indication information. The data range indication information accurately defines the position and range of the target data in the control data set, so that the host can pre-allocate a target memory with an accurate size based on this information. Subsequently, the storage device realizes accurate transmission of the target data between the storage device and the target memory pre-allocated by the host according to the data range indication information, and generates the corresponding execution result after completing the transmission. That is, the host will embed data range indication information when constructing the control command, and accordingly apply for a target memory with a size matching the data range indication information. After receiving the command, the storage device can accurately locate the target data actually needed by the host in the control data by parsing the data range indication information, and realize the transmission of the target data between the storage device and the target memory of the host. Compared with the scheme in the prior art which needs to transmit complete data structure and allocate fixed large memory, the application only transmits the target data actually concerned by the host through the accurate data range indication mechanism, not only significantly improves the utilization rate of the underlying link bandwidth, but also realizes the optimized allocation of memory resources, significantly improves the data interaction efficiency between the storage device and the host.
[0118] Correspondingly, the application also discloses a control data interaction device applied to a host, as shown in Figure 11 The device comprises:
[0119] An item generation module 21 is configured to generate a submission queue item; wherein the first field of the submission queue item contains an operation command type, and when the operation command type is a control command, the second field of the submission queue item contains data range indication information, and the data range indication information represents range information of target data in control data, and the control data is a data set for assisting in completing the control command;
[0120] A memory allocation module 22 is configured to pre-allocate a target memory based on the data range indication information;
[0121] An item issuing module 23 is configured to issue the submission queue item to the storage device, so that the storage device executes the control command according to the data range indication information, realizes the transmission of the target data between the storage device and the target memory of the host, and generates an execution result;
[0122] A result receiving module 24 is configured to receive a completion queue item returned by the storage device and containing the execution result.
[0123] Wherein, the more specific working process of each module can refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.
[0124] Further, the embodiment of the present application further provides a computer program product, comprising computer programs / instructions, which, when executed by a processor, implement the steps of the foregoing control data interaction method.
[0125] Further, the embodiment of the present application further provides an electronic device. Figure 12 The electronic device 30 structure diagram shown in the figure is according to an exemplary embodiment, and the content in the figure cannot be considered as any limitation on the use range of the present application.
[0126] Figure 12 The electronic device 30 structure diagram provided by the embodiment of the present application. The electronic device 30, specifically can include: at least one processor 31, at least one memory 32, display screen 33, input output interface 34, communication interface 35, power supply 36 and communication bus 37. Wherein, the memory 32 is used for storing computer programs, computer programs are loaded and executed by the processor 31, to realize the related steps in the control data interaction method disclosed by any of the foregoing embodiments. In addition, the electronic device 30 in the embodiment specifically can be an electronic computer.
[0127] In the embodiment, the power supply 36 is used for providing working voltage for each hardware device on the electronic device 30; the communication interface 35 can create data transmission channel between the electronic device 30 and the external device, and the communication protocol followed is any communication protocol applicable to the technical solution of the present application, which is not specifically limited here; the input output interface 34 is used for obtaining external input data or outputting data to the outside world, and the specific interface type can be selected according to the specific application needs, which is not specifically limited here.
[0128] In addition, the memory 32 as the carrier of resource storage can be read-only memory, random access memory, disk or optical disk, etc., and the resources stored thereon can include computer programs 321, and the storage mode can be temporary storage or permanent storage. Among them, the computer programs 321 can further include computer programs capable of completing other specific work in addition to the computer programs capable of completing the control data interaction method executed by the electronic device 30 disclosed by any of the foregoing embodiments.
[0129] Further, the embodiment of the present application further discloses a computer readable storage medium for storing computer programs; wherein the computer programs are executed by the processor to implement the foregoing disclosed control data interaction method.
[0130] The specific steps of the method can refer to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.
[0131] The various embodiments are described in a progressive manner, each embodiment focusing on the differences from other embodiments, and the same or similar parts between the various embodiments can be mutually referred to. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method.
[0132] Those skilled in the art will further appreciate that the individual steps of the examples described in connection with the embodiments disclosed herein can be embodied in electronic hardware, computer software, or combinations of both. The various examples have been described in relation to the methods, by and large, with a purpose to illustrate the interchangeability of hardware and software. Whether the individual steps are to be performed in hardware or software depends on the particular applications and design constraints imposed on the overall system. Skilled persons can use various methods to implement the described functions for each particular application, but such implementation should not be considered beyond the scope of the present application.
[0133] The steps of the methods or algorithms described in connection with the embodiments disclosed herein can be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software module can be stored in a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
[0134] Finally, it should be noted that the terms such as first and second, etc. are used herein only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or apparatus including a series of elements includes not only those elements, but also other elements not explicitly listed or inherent to such a process, method, article or apparatus. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of additional identical elements in the process, method, article or apparatus including the above-mentioned element.
[0135] The above describes in detail a control data interaction method, device, computer program product, equipment and medium provided by the present application. The principles and implementation modes of the present application are described by applying specific examples. The above example description is only used to help understand the method and core idea of the present application. Meanwhile, for those skilled in the art, according to the idea of the present application, the specific implementation mode and application range will be changed. As can be seen from the above, the content of the specification should not be understood as a limitation of the present application.
Claims
1. A method of controlling data interaction, characterized by, Applied to a storage device, comprising: parsing a first field of a submission queue item issued by a host to determine an operation command type; when the operation command type is a control command, parsing a second field of the submission queue item to obtain data range indication information; wherein the data range indication information represents range information of target data in control data, and the control data is a data set for assisting completion of the control command; executing the control command according to the data range indication information, realizing transmission of the target data between the storage device and a target memory of the host, and generating an execution result; wherein the target memory is obtained by the host based on the data range indication information in advance; returning a completion queue item containing the execution result to the host; wherein the second field includes a transmission mode field and an address range field, and the data range indication information includes a transmission mode parameter and an address range parameter; wherein the transmission mode field corresponds to the transmission mode parameter, and the address range field corresponds to the address range parameter; wherein the transmission mode parameter includes full transmission or partial transmission, and the address range parameter includes offset information and length information.
2. The method of claim 1, wherein, The execution of the control command according to the data range indication information, realizing the transmission of the target data between the storage device and the target memory of the host, comprises: if the transmission mode parameter in the data range indication information is the full transmission, determining all contents of the control data as the target data, and executing the control command to realize the transmission of the target data between the storage device and the target memory of the host.
3. The method of claim 1, wherein, The execution of the control command according to the data range indication information, realizing the transmission of the target data between the storage device and the target memory of the host, comprises: if the transmission mode parameter in the data range indication information is the partial transmission, determining a starting position of the target data according to the offset information in the address range parameter, and determining an ending position of the target data according to the length information in the address range parameter; determining the target data from the control data according to the starting position and the ending position, and executing the control command to realize the transmission of the target data between the storage device and the target memory of the host.
4. The method of claim 1, wherein, Further comprising: if the value of the transmission mode field is a first numerical value, it is determined that the transmission mode parameter is the full transmission, and if the value of the transmission mode field is a second numerical value, it is determined that the transmission mode parameter is the partial transmission.
5. The method of claim 4, wherein, Further comprising: based on a non-volatile memory host controller interface specification protocol, the first numerical value is configured as 0 and the second numerical value is configured as 1.
6. The method of claim 4, wherein, When the value of the transmission mode field is the first value, the target memory is a static allocation size defined based on a non-volatile memory host controller interface specification protocol, and when the value of the transmission mode field is the second value, the target memory is a dynamic allocation size obtained based on the address range parameter.
7. The method of claim 1, wherein, The execution of the control command according to the data range indication information realizes the transmission of the target data between the storage device and the target memory of the host. When the control command represents that the storage device transmits data to the host, the target data is determined from the locally stored control data according to the data range indication information. The target data is transmitted to the target memory of the host.
8. The method of claim 7, wherein, When the control command represents that the storage device transmits data to the host, the control command includes a state feedback command and a data reporting command; wherein the state feedback command is used to provide state information of the storage device, and the data reporting command is used to transmit operation data of the storage device.
9. The method of claim 1, wherein, The execution of the control command according to the data range indication information realizes the transmission of the target data between the storage device and the target memory of the host. When the control command represents that the host transmits data to the storage device, the target data is determined from the control data of the target memory according to the data range indication information. The target data is transmitted to a preset storage area of the storage device.
10. The method of claim 9, wherein, When the control command represents that the host transmits data to the storage device, the control command includes a state management command and a parameter configuration command; wherein the state management command is used to regulate the working state of the storage device, and the parameter configuration command is used to set the functional parameters of the storage device.
11. The method of claim 1, wherein, The storage device includes a disk array card and a plurality of solid state disks hung to the disk array card.
12. The method of claim 1 to 11, wherein, Further comprising: When multiple control commands exist simultaneously, the priority score of each control command is determined based on the operation urgency and data timeliness of each control command; The actual execution order of each control command is determined according to the initial order of the submission queue entry of the control command in the submission queue and the priority score of the control command.
13. A method of controlling data interaction, characterized by, Applied to a host, comprising: Generating a submission queue entry; wherein the first field of the submission queue entry contains an operation command type, when the operation command type is a control command, the second field of the submission queue entry contains data range indication information, the data range indication information represents range information of target data in control data, and the control data is a data set for assisting the completion of the control command; Preallocating a target memory based on the data range indication information; The submission queue entry is sent to a storage device, so that the storage device executes the control command according to the data range indication information, realizes the transmission of the target data between the storage device and the target memory of the host, and generates an execution result; The submission queue entry is sent to a storage device, so that the storage device executes the control command according to the data range indication information, realizes the transmission of the target data between the storage device and the target memory of the host, and generates an execution result; receiving a completion queue entry returned by the storage device, the completion queue entry containing the execution result; wherein the second field includes a transmission mode field and an address range field, and the data range indication information includes a transmission mode parameter and an address range parameter; wherein the transmission mode field corresponds to the transmission mode parameter, and the address range field corresponds to the address range parameter; wherein the transmission mode parameter includes full transmission or partial transmission, and the address range parameter includes offset information and length information.
14. A control data interaction device, characterized by The application is applied to a storage device, comprising: a field analysis module, configured to analyze a first field of a submission queue entry issued by a host, to determine an operation command type; a range determination module, configured to, when the operation command type is a control command, analyze a second field of the submission queue entry, to obtain data range indication information; wherein the data range indication information indicates range information of target data in control data, and the control data is a data set for assisting completion of the control command; a command execution module, configured to execute the control command according to the data range indication information, to realize transmission of the target data between the storage device and a target memory of the host, and to generate an execution result; wherein the target memory is obtained by pre-allocating the target memory by the host based on the data range indication information; a result return module, configured to return a completion queue entry containing the execution result to the host; wherein the second field includes a transmission mode field and an address range field, and the data range indication information includes a transmission mode parameter and an address range parameter; wherein the transmission mode field corresponds to the transmission mode parameter, and the address range field corresponds to the address range parameter; wherein the transmission mode parameter includes full transmission or partial transmission, and the address range parameter includes offset information and length information.
15. A control data interaction device, characterized by The application is applied to a host, comprising: an entry generation module, configured to generate a submission queue entry; wherein a first field of the submission queue entry contains an operation command type, and when the operation command type is a control command, a second field of the submission queue entry contains data range indication information, which indicates range information of target data in control data, and the control data is a data set for assisting completion of the control command; a memory allocation module, configured to pre-allocate a target memory based on the data range indication information; an entry issuance module, configured to issue the submission queue entry to a storage device, to enable the storage device to execute the control command according to the data range indication information, to realize transmission of the target data between the storage device and the target memory of the host, and to generate an execution result; a result receiving module, configured to receive a completion queue entry returned by the storage device, the completion queue entry containing the execution result; wherein the second field includes a transmission mode field and an address range field, and the data range indication information includes a transmission mode parameter and an address range parameter; wherein the transmission mode field corresponds to the transmission mode parameter, and the address range field corresponds to the address range parameter; The transmission mode parameter includes full transmission or partial transmission, and the address range parameter includes offset information and length information.
16. A computer program product comprising computer programs / instructions, characterized in that, The computer program / instruction is executed by the processor to implement the steps of the control data interaction method in any one of claims 1 to 13.
17. An electronic device, comprising: Comprise: A memory for saving a computer program; A processor for executing the computer program to implement the control data interaction method in any one of claims 1 to 13.
18. A computer-readable storage medium, characterized in that, A memory for saving a computer program; wherein the computer program is executed by the processor to implement the control data interaction method in any one of claims 1 to 13. A memory for saving a computer program; wherein the computer program is executed by the processor to implement the control data interaction method in any one of claims 1 to 13.
Citation Information
Patent Citations
Storage device and method and electronic equipment
CN117337425A
Code coverage rate data exporting method and device, equipment and medium
CN119149429A