WO2022126534A1 - 数据处理方法及相关设备 - Google Patents

数据处理方法及相关设备 Download PDF

Info

Publication number
WO2022126534A1
WO2022126534A1 PCT/CN2020/137321 CN2020137321W WO2022126534A1 WO 2022126534 A1 WO2022126534 A1 WO 2022126534A1 CN 2020137321 W CN2020137321 W CN 2020137321W WO 2022126534 A1 WO2022126534 A1 WO 2022126534A1
Authority
WO
WIPO (PCT)
Prior art keywords
identifier
data packet
command
context information
host
Prior art date
Application number
PCT/CN2020/137321
Other languages
English (en)
French (fr)
Inventor
刘荣国
杨应琼
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2020/137321 priority Critical patent/WO2022126534A1/zh
Priority to CN202080107940.4A priority patent/CN116964565A/zh
Publication of WO2022126534A1 publication Critical patent/WO2022126534A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/06Addressing a physical block of locations, e.g. base addressing, module addressing, memory dedication

Definitions

  • the present application relates to the technical field of data processing, and in particular, to a data processing method and related equipment.
  • UFS Universal Flash Storage
  • IO input and output
  • LUN Logical Unit Number
  • Task Tag Task Tag
  • IID Initiator ID
  • UFS Host UFS host
  • UFS Device UFS storage device
  • UFS transport protocol UTP
  • UTP Transfer Request UFS Host and UFS Device logic will maintain the context (IO context) information of 32 concurrent commands, UFS Host and UFS Device each time they receive the peer's After UFS Protocol Information Units (UPIU), use the combination of "LUN+Task Tag+IID" three field segments to reversely find which of the 32 context information it belongs to; that is, use "LUN+Task Tag+IID" +Task Tag+IID” combination of three fields to find the index address of the context information, and then find the context information through the index address.
  • UPIU UFS Protocol Information Unit
  • Embodiments of the present application provide a data processing method and related equipment, so as to reduce delay overhead and improve data processing efficiency.
  • an embodiment of the present application provides a data processing device, including: a host controller and a storage controller; the host controller is configured to, when sending a command to the storage controller, establish first context IO context information in the command The mapping relationship with the first identification, wherein the first IO context information includes the second identification; the host controller is also used to send the first data packet to the storage controller, wherein the first data packet includes the first identification and The second identification; the storage controller is used to receive the first data packet, and obtain the second IO context information corresponding to the second identification from the first data packet according to the first identification, and establish the first identification and the second IO context The mapping relationship between the information; wherein, the first identifier is used to index the first IO context information or the second IO context information.
  • the host controller when sending a command to the storage controller, the host controller establishes a mapping relationship between the first context IO context information in the command and the first identifier, and then sends the first data packet to the storage controller Because the second identification in the first identification and the first IO context information is included in the first data packet, the storage controller, after receiving the first data packet, obtains from the first data packet and the second identification according to the first identification The corresponding second IO context information, and the mapping relationship between the first identification and the second IO context information is established; so, the first identification and the first IO context information and the second IO context information have all established a mapping relationship, and the host controls The storage controller can quickly find the first IO context information through the first identifier, and the storage controller can also quickly find the second IO context information through the first identifier, thereby reducing delay overhead and improving data processing efficiency.
  • the host controller can directly search for the first identifier through the first identifier.
  • IO context information there is no need to reversely search the first IO context information through the second identifier.
  • the second identifier is "LUN+Task Tag+IID", and there is no need to pass the combination of the three fields of "LUN+Task Tag+IID”.
  • the storage controller can directly search for the second IO context information through the first identifier, and does not need to reverse the direction through the second identifier.
  • the second identifier is "LUN+Task Tag+IID"
  • the first identifier is directly used as the index address of the second IO context information
  • the second IO context information is directly found through the first identifier.
  • the storage controller finds The logic of the second IO context information is simplified, and the time-consuming for the storage controller to find the second IO context information is also reduced.
  • the embodiments of the present application can reduce delay overhead and improve data processing efficiency.
  • the command is a read command
  • the storage controller is further configured to send a second data packet to the host controller, where the second data packet includes data corresponding to the first identifier and the read command
  • the host controls
  • the device is also used to receive the second data packet, and index the first IO context information according to the first identifier, and process the data corresponding to the read command according to the first IO context information.
  • the storage controller when the command sent by the host controller to the storage controller is a read command, the storage controller will send a second data packet to the host controller; since the second data packet includes the first identifier and the read command Corresponding data, and the first identification and the first IO context information have established a mapping relationship, so after receiving the second data packet, the host controller searches for the first IO according to the first identification carried in the second data packet. context information, and then process the data corresponding to the read command according to the first IO context information, for example, decrypt and store the data corresponding to the read command according to the first IO context information, thereby reducing the host controller finding the first IO context information. time-consuming, and improve the efficiency of processing the data corresponding to the read command.
  • the second data packet further includes a second identifier; the host controller is further configured to: compare the second identifier in the second data packet with the second identifier in the first IO context information Yes, to perform fault-tolerant detection on the first IO context information.
  • the host controller after receiving the second data packet, the host controller also compares the second identifier in the second data packet with the second identifier in the first IO context information to compare the first IO
  • the context information is used for fault-tolerant detection, that is, the mapping relationship between the first identifier and the second identifier in the second data packet is compared with the mapping relationship between the first identifier and the second identifier in the first IO context information maintained in the host controller. Whether it is consistent, thereby helping to ensure that the first IO context information found according to the first identification is correct, that is, the first IO context information found according to the first identification is corresponding to the second data packet.
  • the command is a write command; the storage controller is further configured to send a third data packet to the host controller, where the third data packet includes a first identifier, and the third data packet is used to indicate the host The controller sends the data corresponding to the write command to the storage controller; the host controller is also used to receive the third data packet, and index to the first IO context information according to the first identifier, and to the storage controller according to the first IO context information Send the fourth data packet, wherein, the fourth data packet includes the data corresponding to the first identification and the write command; the storage controller is also used to receive the fourth data packet, and index to the second IO context information according to the first identification, and The data corresponding to the write command is processed according to the second IO context information.
  • the storage controller when the command sent by the host controller to the storage controller is a write command, the storage controller will send a third data packet to the host controller, instructing the host controller to send the write command corresponding to the storage controller. data; because the third data packet includes the first identification, after the host controller receives the third data packet, it indexes to the first IO context information according to the first identification, and sends the fourth data to the storage controller according to the first IO context information package, specifically, obtain the storage address of the data corresponding to the write command on this side according to the first IO context information, read the data corresponding to the write command and encrypt the data, and then send the fourth data packet to the storage controller Because the 4th data packet comprises the first identification, after the storage controller receives the 4th data packet, according to the first identification index to the second IO context information, and according to the second IO context information, the data corresponding to the write command is processed, For example, the data corresponding to the write command is stored; for the host controller, since the first IO context
  • the third data packet further includes a second identifier; the host controller is further configured to: compare the second identifier in the third data packet with the second identifier in the first IO context information Yes, to perform fault-tolerant detection on the first IO context information.
  • the fourth data packet further includes a second identifier; the storage controller is further configured to: compare the second identifier in the fourth data packet with the second identifier in the second IO context information Yes, to perform fault-tolerant detection on the second IO context information.
  • the host controller is further configured to acquire the first identifier from a preset identifier list stored in the host controller, and delete the first identifier in the preset identifier list.
  • the first identifier is acquired from a preset identifier list stored in the host controller, and the host controller acquires the first identifier from the preset identifier list when sending a command to the storage controller; Since multiple commands may be executed concurrently between the host controller and the storage controller, and in order to prevent the multiple concurrently executed commands from interfering with each other, the first identifiers corresponding to each of the multiple commands are different; Therefore, for any command, after obtaining a first identifier from the preset identifier list, it is also necessary to delete the first identifier in the preset identifier list, so as to ensure that each command in the multiple concurrently executed commands can be ensured.
  • the adopted first identifiers are different to ensure that multiple commands executed concurrently do not interfere with each other.
  • the storage controller is further configured to send a fifth data packet to the host controller, and release the mapping relationship between the first identifier and the second IO context information, wherein the fifth data packet includes The first identification, the fifth data packet is used to indicate that the command has been executed; the host controller is also used to receive the fifth data packet, and write the first identification into the preset identification list, and release the first IO context information and The mapping relationship between the first identifiers.
  • the storage controller sends a fifth data packet to the host controller, and the fifth data packet indicates that the host controller command has been executed, and releases the mapping relationship between the first identifier and the second IO context information Because the 5th data packet includes the first sign, after receiving the 5th data bag, the host controller writes the first sign in the 5th data bag into the preset identification list, and releases the first IO context information and The mapping relationship between the first identifiers; because after the command execution is completed, the host controller will write the first identifier into the preset identifier list, so when the host controller sends another command to the storage controller, the host controller will The first identification can be obtained from the preset identification list for the execution of another command, that is, the first identification corresponding to each command can be recycled after the execution of the command is completed; and, after the execution of the command is completed.
  • the host controller will release the mapping relationship between the first IO context information and the first identifier, and the storage controller will release the mapping relationship between the first identifier and the second IO context information, so that the previously executed command will not interfere with other commands to be executed after.
  • the host controller is further configured to write the first identifier into the preset identifier list when the command execution is abnormal, and release the mapping relationship between the first IO context information and the first identifier ;
  • the storage controller is also used to release the mapping relationship between the first identification and the second IO context information when the command execution is abnormal.
  • the host controller when the command execution is abnormal, the host controller will write the first identifier into the preset identifier list and release the mapping relationship between the first IO context information and the first identifier, and the storage controller will release the The mapping relationship between the first identification and the second IO context information; therefore, in the case of an abnormal command execution, the first identification corresponding to the command can also be recycled, and the abnormal execution of the command will not interfere with subsequent execution. other commands.
  • the host controller is specifically used for: judging whether the number of concurrently executed commands between the host controller and the storage controller reaches a preset threshold; The first identification is obtained from the identification list, and the first identification in the preset identification list is deleted. Further, the number of the first identifiers in the preset identifier list is equal to the preset threshold.
  • the host controller when sending a command to the storage controller, the host controller first determines whether the number of concurrently executed commands between the host controller and the storage controller reaches a preset threshold.
  • the command can be executed normally, and the first identifier can be obtained from the preset identifier list. And delete the first identifier in the preset identifier list, so as to ensure that the command can be executed normally.
  • the host controller is further configured to: write the first identifier into the first data packet; use the first identifier as the index address of the COMMAND context table of the first command context, wherein the first COMMAND context
  • the table is the COMMAND context table stored in the host controller.
  • the host controller since the host controller establishes a mapping relationship between the first identifier and the first IO context information, the host controller writes the first identifier into the first data packet, and sends the first data packet to the storage controller, and then The data packets interacting between the storage controller and the host controller all carry the first identifier, and the host controller uses the first identifier as the index address of the first COMMAND context table stored in the host controller, so that the host controller can pass the first identifier.
  • the first identifier carried in the data packet sent by the storage controller searches for the first IO context information in the first COMMAND context table, thereby reducing the time-consuming to find the first IO context information.
  • the storage controller is further configured to: obtain second IO context information from a second COMMAND context table according to the first identifier, where the second COMMAND context table is stored in the storage controller COMMAND context table.
  • the first identifier is used as the index address of the second COMMAND context table stored in the storage controller, and the storage controller After receiving the data packet sent by the host controller, the second IO context information is searched in the second COMMAND context table through the first identifier carried in the data packet, so as to reduce the time-consuming to find the second IO context information .
  • an embodiment of the present application provides a host, including a host controller; the host controller is configured to: when sending a command to a storage device, establish a relationship between the first context IO context information in the command and the first identifier Mapping relationship; wherein, the first identifier is used to index the first IO context information.
  • the host controller is further configured to: send a first data packet to the storage device, where the first data packet includes a first identifier.
  • the command is a read command; the host controller is further configured to: receive a second data packet from the storage device, wherein the second data packet includes the first identifier and data corresponding to the read command; according to The first identifier is indexed to the first IO context information, and the data corresponding to the read command is processed according to the first IO context information.
  • the second data packet further includes a second identifier
  • the first IO context information includes the second identifier
  • the host controller is further configured to: associate the second identifier in the second data packet with the first identifier
  • the second identifier in the IO context information is compared to perform fault-tolerant detection on the first IO context information.
  • the command is a write command
  • the host controller is further configured to: receive a third data packet from the storage device, where the third data packet includes a first identifier, and the third data packet is used to indicate The host sends the data corresponding to the write command to the storage device; the first IO context information is indexed according to the first identification, and the fourth data packet is sent to the storage device according to the first IO context information, wherein the fourth data packet includes the first identification and Write the data corresponding to the command.
  • the third data packet further includes a second identifier; the host controller is further configured to: compare the second identifier in the third data packet with the second identifier in the first IO context information Yes, to perform fault-tolerant detection on the first IO context information.
  • the host controller is further configured to: acquire the first identifier from a preset identifier list stored in the host controller, and delete the first identifier in the preset identifier list.
  • the host controller is further configured to: receive a fifth data packet from the storage device, where the fifth data packet includes the first identifier, and the fifth data packet is used to indicate that the command has been executed;
  • the first identification is written in the preset identification list, and the mapping relationship between the first IO context information and the first identification is released.
  • the host controller is further configured to: when the command execution is abnormal, write the first identifier into the preset identifier list, and release the mapping between the first IO context information and the first identifier relation.
  • the host controller is specifically configured to: determine whether the number of concurrently executed commands between the host and the storage device reaches a preset threshold; The first identifier is acquired, and the first identifier in the preset identifier list is deleted.
  • the host controller is further configured to: write the first identifier into the first data packet; use the first identifier as the index address of the COMMAND context table of the first command context, wherein the first COMMAND context
  • the table is the COMMAND context table stored in the host controller.
  • an embodiment of the present application provides a storage device, including a storage controller; the storage controller is configured to: receive a first data packet from a host, wherein the first data packet includes a first identifier and a second identifier Obtain the second context IO context information corresponding to the second mark from the first data packet according to the first mark, and establish the mapping relationship between the first mark and the second IO context information; Wherein, the first mark is used for indexing Second IO context information.
  • the first data packet is a data packet corresponding to the read command; the storage controller is further configured to: send a second data packet to the host, wherein the second data packet includes the first identifier and the read command corresponding data.
  • the first data packet is a data packet corresponding to the write command; the storage controller is further configured to: send a third data packet to the host, wherein the third data packet includes the first identifier, and the third data packet The data packet is used to instruct the host to send the data corresponding to the write command to the storage device; receive a fourth data packet from the host, wherein the fourth data packet includes the first identifier and the data corresponding to the write command; index to the second data packet according to the first identifier IO context information, and the data corresponding to the write command is processed according to the second IO context information.
  • the fourth data packet further includes a second identifier; the storage controller is further configured to: compare the second identifier in the fourth data packet with the second identifier in the second IO context information Yes, to perform fault-tolerant detection on the second IO context information.
  • the storage controller is further configured to: send a fifth data packet to the host, and release the mapping relationship between the first identifier and the second IO context information, wherein the fifth data packet includes the first A flag, the fifth data packet is used to indicate that the command has been executed.
  • the storage controller is further configured to: when the command execution is abnormal, release the mapping relationship between the first identifier and the second IO context information.
  • the storage controller is further configured to: obtain the second IO context information from the second command context COMMAND context table according to the first identifier, wherein the second COMMAND context table is stored in the storage controller COMMAND context table in .
  • an embodiment of the present application provides an electronic device, including: a host and a storage device coupled to the host; the host is the host described in any one of the second aspect above; the storage device is any one of the third aspect above the described storage device.
  • an embodiment of the present application provides a data processing method, which is applied to an electronic device, where the electronic device includes a host controller and a storage controller; the method includes: when sending a command to the storage controller, establishing a The mapping relationship between the first context IO context information and the first identifier in the command, wherein the first IO context information includes the second identifier; the host controller sends a first data packet to the storage controller, wherein the first data The bag includes the first identification and the second identification; the first data packet is received by the storage controller, and the second IO context information corresponding to the second identification is obtained from the first data packet according to the first identification, and the first identification and the The mapping relationship between the second IO context information; wherein, the first identifier is used to index the first IO context information or the second IO context information.
  • the command is a read command; the method further includes: sending a second data packet to the host controller through the storage controller, wherein the second data packet includes the first identifier and the data corresponding to the read command; The second data packet is received by the host controller, and the first IO context information is indexed according to the first identifier, and the data corresponding to the read command is processed according to the first IO context information.
  • the second data packet further includes a second identifier; the method further includes: comparing the second identifier in the second data packet with the second identifier in the first IO context information by the host controller Compare to perform fault-tolerant detection on the first IO context information.
  • the command is a write command; the method further includes: sending a third data packet to the host controller through the storage controller, wherein the third data packet includes the first identifier, and the third data packet is used for Instruct the host controller to send the data corresponding to the write command to the storage controller; receive the third data packet through the host controller, and index to the first IO context information according to the first identifier, and send to the storage controller according to the first IO context information
  • the fourth data packet wherein the fourth data packet includes the data corresponding to the first identification and the write command; the fourth data packet is received by the storage controller, and is indexed to the second IO context information according to the first identification, and according to the second IO
  • the context information processes the data corresponding to the write command.
  • the third data packet further includes a second identifier; the method further includes: comparing the second identifier in the third data packet with the second identifier in the first IO context information through the host controller Compare to perform fault-tolerant detection on the first IO context information.
  • the fourth data packet further includes a second identifier; the method further includes: comparing the second identifier in the fourth data packet with the second identifier in the second IO context information by the storage controller Compare to perform fault-tolerant detection on the second IO context information.
  • the method further includes: acquiring, through the host controller, the first identifier from a preset identifier list stored in the host controller, and deleting the first identifier in the preset identifier list.
  • the method further includes: sending a fifth data packet to the host controller through the storage controller, and releasing the mapping relationship between the first identifier and the second IO context information, wherein the fifth data packet is The package includes the first identification, and the fifth data packet is used to indicate that the command has been executed and completed; the fifth data packet is received by the host controller, and the first identification is written in the preset identification list, and the first IO context information and the first identification are released.
  • the method further includes: when the command execution is abnormal, writing the first identifier into the preset identifier list through the host controller, and releasing the connection between the first IO context information and the first identifier mapping relationship; and releasing the mapping relationship between the first identifier and the second IO context information through the storage controller.
  • obtaining the first identifier from a preset identifier list stored in the host controller by the host controller, and deleting the first identifier in the preset identifier list includes: determining by the host controller Whether the number of concurrently executed commands between the host controller and the storage controller has reached the preset threshold; if the number of commands not reached the preset threshold, obtain the first identifier from the preset identifier list through the host controller, and delete the preset identifier list The first identifier in .
  • the method further includes: using the host controller to write the first identifier into the first data packet; using the host controller to use the first identifier as the index address of the first command context COMMAND context table, wherein , the first COMMAND context table is the COMMAND context table stored in the host controller.
  • the method further includes: acquiring second IO context information from a second COMMAND context table through the storage controller according to the first identifier, wherein the second COMMAND context table is stored in the storage controller COMMAND context table.
  • an embodiment of the present application provides a data processing method, which is applied to a host, where the host includes a host controller; the method includes: when sending a command to a storage device, establishing a first context IO in the command through the host controller The mapping relationship between the context information and the first identifier; wherein, the first identifier is used to index the first IO context information.
  • the method further includes: sending a first data packet to the storage device through the host controller, where the first data packet includes a first identifier.
  • the command is a read command; the method further includes: receiving, through the host controller, a second data packet from the storage device, wherein the second data packet includes the first identifier and data corresponding to the read command; The host controller indexes to the first IO context information according to the first identifier, and processes the data corresponding to the read command according to the first IO context information.
  • the second data packet further includes a second identifier
  • the first IO context information includes the second identifier
  • the method further includes: using the host controller to associate the second identifier in the second data packet with the first identifier.
  • a second identifier in the IO context information is compared to perform fault-tolerant detection on the first IO context information.
  • the command is a write command; the method further includes: receiving, through the host controller, a third data packet from the storage device, wherein the third data packet includes the first identifier, and the third data packet is used for Instruct the host to send the data corresponding to the write command to the storage device; index the first IO context information according to the first identifier by the host controller, and send the fourth data packet to the storage device according to the first IO context information, wherein the fourth data packet The first identifier and the data corresponding to the write command are included.
  • the third data packet further includes a second identifier; the method further includes: comparing the second identifier in the third data packet with the second identifier in the first IO context information through the host controller Compare to perform fault-tolerant detection on the first IO context information.
  • the method further includes: acquiring, through the host controller, the first identifier from a preset identifier list stored in the host controller, and deleting the first identifier in the preset identifier list.
  • the method further includes: receiving, through the host controller, a fifth data packet from the storage device, where the fifth data packet includes the first identifier, and the fifth data packet is used to indicate that the command has been executed. ; Write the first identification in the preset identification list by the host controller, and release the mapping relationship between the first IO context information and the first identification.
  • the method further includes: when the command execution is abnormal, writing the first identifier into the preset identifier list through the host controller, and releasing the connection between the first IO context information and the first identifier Mapping relations.
  • obtaining the first identifier from a preset identifier list stored in the host controller by the host controller, and deleting the first identifier in the preset identifier list includes: determining by the host controller Whether the number of concurrently executed commands between the host and the storage device reaches the preset threshold; if it does not reach the preset threshold, obtain the first identifier from the preset identifier list through the host controller, and delete the first identifier in the preset identifier list. an identification.
  • the method further includes: using the host controller to write the first identifier into the first data packet; using the host controller to use the first identifier as the index address of the first command context COMMAND context table, wherein , the first COMMAND context table is the COMMAND context table stored in the host controller.
  • an embodiment of the present application provides a data processing method, which is applied to a storage device, where the storage device includes a storage controller; the method includes: receiving, through the storage controller, a first data packet from a host, wherein the first data packet is The data packet includes a first identification and a second identification; the storage controller obtains the second context IO context information corresponding to the second identification from the first data packet according to the first identification, and establishes the first identification and the second IO context information The mapping relationship between; wherein, the first identifier is used to index the second IO context information.
  • the first data packet is a data packet corresponding to the read command; the method further includes: sending a second data packet to the host through the storage controller, wherein the second data packet includes the first identifier and the read command. data corresponding to the command.
  • the first data packet is a data packet corresponding to the write command; the method further includes: sending a third data packet to the host through the storage controller, wherein the third data packet includes the first identifier, the first The three data packets are used to instruct the host to send the data corresponding to the write command to the storage device; the fourth data packet is received from the host through the storage controller, wherein the fourth data packet includes the first identifier and the data corresponding to the write command; through the storage controller The controller indexes the second IO context information according to the first identifier, and processes the data corresponding to the write command according to the second IO context information.
  • the fourth data packet further includes a second identifier; the method further includes: comparing the second identifier in the fourth data packet with the second identifier in the second IO context information by the storage controller Compare to perform fault-tolerant detection on the second IO context information.
  • the method further includes: sending a fifth data packet to the host through the storage controller, and releasing the mapping relationship between the first identifier and the second IO context information, wherein the fifth data packet includes The first identifier and the fifth data packet are used to indicate that the command has been executed.
  • the method further includes: when the command execution is abnormal, releasing the mapping relationship between the first identifier and the second IO context information through the storage controller.
  • the method further includes: acquiring second IO context information from the second command context COMMAND context table according to the first identifier by the storage controller, wherein the second COMMAND context table is stored in the storage controller COMMAND context table in the server.
  • an embodiment of the present application provides an electronic device, including a processor, a memory, a communication interface, and one or more programs, where the one or more programs are stored in the memory and configured to be processed by the above-mentioned processing
  • the above program includes instructions for performing the steps in the method according to any one of the above fifth aspects.
  • an embodiment of the present application provides a chip, including: a processor for calling and running a computer program from a memory, so that a device installed with the chip executes the fifth aspect or the sixth aspect or the seventh aspect The method of any one of the aspects.
  • an embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed, implements the fifth aspect or the sixth aspect or the seventh aspect The flow of any one of the data processing methods.
  • an embodiment of the present application provides a computer program, where the computer program includes instructions, when the computer program is executed, implements any one of the fifth aspect or the sixth aspect or the seventh aspect. Data processing method flow.
  • FIG. 1 is a schematic diagram of a data structure of a UPIU in a UFS protocol provided by an embodiment of the present application.
  • FIG. 2 is a schematic diagram of a data structure of command context information maintained inside a UFS Host and UFS Device provided by an embodiment of the present application.
  • FIG. 3 is a schematic diagram of a processing flow that a UFS Host internally receives a UPIU according to an embodiment of the present application.
  • FIG. 4 is a schematic diagram of a processing flow that a UFS Device internally receives a UPIU according to an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a host and a storage device provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of a data structure of a UPIU provided by an embodiment of the present application.
  • Fig. 7 is a kind of schematic flow chart of executing read command interaction between UFS Host and UFS Device provided by an embodiment of the present application.
  • FIG. 8 is a schematic flowchart of a write command interaction between a UFS Host and a UFS Device provided by an embodiment of the present application.
  • FIG. 9 is a schematic flowchart of cooperation and interaction between a UFS Host and a UFS Device provided by an embodiment of the present application.
  • FIG. 10 is a schematic diagram of an idle local ID (Local ID) queue provided by an embodiment of the present application.
  • FIG. 11 is a schematic diagram of a context information table provided by an embodiment of the present application.
  • FIG. 12 is a schematic flowchart of a data processing method provided by an embodiment of the present application.
  • FIG. 13 is a schematic flowchart of another data processing method provided by an embodiment of the present application.
  • a component may be, but is not limited to, a process running on a processor, a processor, an object, an executable, a thread of execution, a program, and/or a computer.
  • an application running on a computing device and the computing device may be components.
  • One or more components may reside within a process and/or thread of execution, and a component may be localized on one computer and/or distributed between 2 or more computers.
  • these components can execute from various computer readable media having various data structures stored thereon.
  • a component may, for example, be based on a signal having one or more data packets (eg, data from two components interacting with another component between a local system, a distributed system, and/or a network, such as the Internet interacting with other systems via signals) Communicate through local and/or remote processes.
  • data packets eg, data from two components interacting with another component between a local system, a distributed system, and/or a network, such as the Internet interacting with other systems via signals
  • FIG. 1 is a schematic diagram of a data structure of a UPIU in a UFS protocol provided by an embodiment of the present application.
  • the unique identifier that distinguishes an IO is "LUN+Task Tag+IID".
  • LUN is used to distinguish commands to different logical units (LU)
  • Task Tag is a certain host.
  • the tag number (Tag) sent to the IO corresponding to a certain LU, and the IID is used to distinguish different hosts.
  • all UPIU transmissions need to carry the information of "LUN+Task Tag+IID", which is used for the peer to identify a unique IO.
  • the UFS protocol standard does not define additional mechanisms to improve the processing efficiency in this scenario, and "LUN+Task Tag+IID" is used as the unique identifier in command interaction.
  • LUN+Task Tag+IID is used as the unique identifier in command interaction.
  • FIG. 2 is a schematic diagram of a data structure of command context information maintained within a UFS Host and a UFS Device provided by an embodiment of the present application.
  • a common implementation scheme at present is to maintain a set of context information for each command within the UFS Host controller and the UFS Device controller; for example, in UFS3.1 and Earlier versions, the concurrency of UTP Transfer Request is 32, so the UFS Host controller and UFS Device controller need to maintain 32 sets of command context information.
  • FIG. 3 is a schematic diagram of a processing flow of receiving a UPIU inside a UFS Host provided by an embodiment of the present application. Specifically include the following steps.
  • the UFS Host logic receives a ready-to-transfer UPIU (RTTUPIU)/data input UPIU (DATA IN UPIU)/response UPIU (RESPONSE UPIU).
  • RTTUPIU ready-to-transfer UPIU
  • DATA IN UPIU data input UPIU
  • REsponse UPIU REsponse UPIU
  • FIG. 4 is a schematic diagram of a processing flow that a UFS Device internally receives a UPIU according to an embodiment of the present application. Specifically include the following steps.
  • the UFS Device logic receives a data output UPIU (DATA OUTUPIU).
  • both the UFS Host and the UFS Device controller need to perform a reverse search on the received UPIU to match the command context. search operation.
  • UFS Host and UFS Device controller logic in the entire command interaction process, each time a UPIU frame sent by the opposite end is received, it is necessary to use "LUN+Task Tag+IID" to reversely search for the corresponding context information, and operate complex and time-consuming.
  • an embodiment of the present application provides a host and a storage device.
  • FIG. 5 is a schematic structural diagram of a host and a storage device according to an embodiment of the application.
  • the host 50 may be any computing device that generates data, such as a server, a personal computer, a tablet computer, a mobile phone, and a personal digital assistant. , smart wearable devices and other various devices; the storage device 503 can be any non-volatile memory that provides the host 50 with the function of storing/reading data.
  • the storage device 503 may be built into the host 50, or may be separate devices from the host 50, or the storage device 503 and the host 50 may be co-located in an electronic device, which is not covered in this application. Specific restrictions.
  • the host 50 or the storage device 503 may be a chip or a chip set or a circuit board equipped with the chip or the chip set, and the chip or the chip set or the circuit board equipped with the chip or the chip set can be driven by necessary software. specifically,
  • the host 50 may include a processor (central processing unit, CPU) 500 and an internal memory 501.
  • the host controller 502 may also be included, and further, it may also include all physical devices on the application processing side such as the power supply, other input and output controllers, and interfaces not shown in FIG. 5 . in,
  • Processor 500 An operating system, a file system (such as a flash file system F2FS) or an application program, etc. can be executed to control various hardware or software elements connected to the processor 500, and can process various data and perform operations.
  • the processor 500 can load the instructions or data stored in the storage device 503 into the internal memory 501, and transfer the instructions or data that need to be calculated to the processor 500 for operation. After the operation is completed, the processor 500 temporarily stores the result.
  • the instructions or data that need to be stored for a long time are stored in the storage device 503 through the host controller 502 .
  • the processor 500 may include one or more processing units (also referred to as processing cores), for example, the processor 500 may include a central processing unit (CPU), an application processing unit (application processor, AP), a modem processing unit, a graphics Processing unit (graphics processing unit, GPU), image signal processing unit (image signal processor, ISP), video codec unit, digital signal processing unit (digital signal processor, DSP), baseband processing unit and neural network processing unit (neural- One or more of the network processing unit, NPU), etc. Wherein, different processing units may be independent devices, or may be integrated in one or more devices.
  • a memory may also be provided in the processor 500 for storing instructions and data.
  • the memory in the processor 500 is a cache memory (Cache).
  • the Cache can store instructions or data that have just been used or recycled by the processor 500 . If the processor 500 needs to use the instruction or data again, it can be called directly from the cache. Repeated accesses are avoided, and the waiting time of the processor 500 is reduced, thereby increasing the efficiency of the system. Further, the processor 500 may also be implemented as a System on Chip (SoC).
  • SoC System on Chip
  • the internal memory 501 is usually a power-off volatile memory, and the content stored thereon will be lost when power is off, and may also be referred to as a memory (Memory) or a main memory.
  • the internal memory 501 in this application includes a readable and writable running memory, which is used for temporarily storing the operation data in the processor 500 and interacting with the storage device 503 or other external memory, which can be used as an operating system or other Storage medium for temporary data of running programs. For example, the operating system running on the processor 500 transfers the data to be calculated from the internal memory 501 to the processor 500 for calculation, and after the calculation is completed, the processor 500 transmits the result.
  • the internal memory 501 may include one or more of dynamic random access memory (DRAM), static random access memory (SRAM), synchronous dynamic random access memory (SDRAM), and the like.
  • DRAM also includes double-rate synchronous dynamic random access memory (Double Data Rate Synchronous Dynamic Random Access Memory, DDR SDRAM) referred to as DDR, second-generation double-rate synchronous dynamic random access memory (DDR2), and third-generation double-rate synchronous dynamic random access memory (DDR2). DDR3), fourth-generation low-power double data rate synchronous dynamic random access memory (Low Power Double Data Rate 4, LPDDR4) and fifth-generation low-power double data rate synchronous dynamic random access memory (Low Power Double Data Rate 5, LPDDR5), etc. .
  • DDR SDRAM Double Data Rate Synchronous Dynamic Random Access Memory
  • DDR2 second-generation double-rate synchronous dynamic random access memory
  • DDR2 third-generation double-rate synchronous dynamic random access memory
  • DDR3 fourth-generation low-power double data rate synchronous dynamic random access memory
  • the host controller 502 is used to manage and control the communication between the host 50 and the storage device 503, and provide a standardized (eg universal flash storage UFS standard) interface for the communication between the host 50 and the storage device 503. Specifically, the host controller 502 can transmit commands (eg, write, read, erase, etc. commands) and data to the storage device 503 according to the read/write request issued by the processor 500, and read/write according to the storage device 503. The results of writing data and the like feed back events (such as command completion events, command status events, hardware error events, etc.) to the host 50 .
  • commands eg, write, read, erase, etc. commands
  • data e.g, data to the storage device 503 according to the read/write request issued by the processor 500, and read/write according to the storage device 503.
  • the results of writing data and the like feed back events (such as command completion events, command status events, hardware error events, etc.) to the host 50 .
  • the host controller 502 can convert the command or data into a data packet supporting a certain protocol by encapsulation, and the host controller 502 performs the reverse operation for the data received by the host 50 .
  • a host can support multiple host controllers (Host Controllers) to support communication with storage devices of different protocols.
  • the host controller 502 generates the write command, read command, erase command, etc. involved in the present application according to the protocol (eg UFS protocol) supported between the host 50 and the storage device 503 .
  • the functions of the host controller 502 may also be integrated in the processor 500, that is, the processor 500 completes the above functions of the host controller 502, which are not specifically limited here.
  • the storage device 503 includes at least one storage area 5031 . Further, the storage device 503 may further include a storage controller 5032 . in,
  • the storage device 503 is a non-volatile memory, and its stored content will not be lost after the power is turned off.
  • the storage device 503 (including the storage area 5031 ) can be used for long-term storage of instructions and data related to the operation of the host 50 , such as startup programs, operating systems, application programs and data, and the like.
  • the processor 500 in the host 50 cannot directly read the instructions and data in the storage device 503 nor directly write the instructions or data to the storage device 503, therefore, when the processor 500 executes the read (or load) command, actually The content to be read (including instructions and/or data) stored in the storage device 503 is temporarily loaded into the internal memory 501 by the host controller 502, and then read out from the internal memory 501 by the processor 500;
  • the processor 500 When executing a write (ie, store) command, the processor 500 first temporarily writes the data to be stored (including instructions and/or data) into the internal memory 501, and then stores the data from the internal memory 501 through the host controller 502. to the storage device 503.
  • the performance of the storage device 503 such as the read rate, the write rate, the erasing rate, the number of times of erasing and writing, the data retention capability, etc., has a great impact on the performance of the host 50, and determines whether the host 50 or the electronic device where the host 50 is located can work normally. , stable and efficient operation.
  • the storage device 503 may include universal flash storage (UFS), fast non-volatile memory (Non-Volatile Memory Express, NVMe), serial attached small computer system interface (Serial Attached Small Computer System Interface, SAS) storage, One or more of Flash flash (eg, NAND flash, NOR flash, etc.), embedded multimedia card eMMC, general-purpose flash storage multi-chip package uMCP memory, embedded multimedia card multi-chip package eMCP memory, solid state drive (SSD), etc. . Further, the storage device 503 may also include other storage media such as a mechanical hard disk (Hard Disk Drive, HDD).
  • UFS universal flash storage
  • NVMe non-Volatile Memory Express
  • SAS Serial Attached Small Computer System Interface
  • Flash flash eg, NAND flash, NOR flash, etc.
  • embedded multimedia card eMMC general-purpose flash storage multi-chip package uMCP memory
  • embedded multimedia card multi-chip package eMCP memory solid state drive (SSD), etc.
  • SSD solid state
  • the storage controller 5032 is an interface device between the host 50 and the storage device 503, and its function is mainly to convert the interface, and convert the read, write, delete and other commands issued by the host 50 (for example, the host controller in the host 50) into storage.
  • the signal that the device 503 can recognize can also complete the address decoding between the host 50 and the storage device 503 (for example, the mapping between the logical address of the host 50 and the physical address in the storage device 503), the conversion of data formats (such as the data bit width) )Wait.
  • the storage controller 5032 can perform necessary control over the access to the storage device 503 where it is located according to certain timing rules, including the control of address signals, data signals and various command signals, so that the host 50 can use the storage device as required.
  • the storage controller 5032 receives and parses the read command or write command sent by the host controller 502 in the host 50, and according to the logical address of the data carried in the read command or the write command, the logical address of the data is based on the fixed address.
  • the mapping relationship is resolved into a physical address, and then the location of the data to be read or written is searched, and finally a control signal corresponding to the command is sent to the storage area 5031 .
  • the processor 500 and the internal memory 501, the host controller and the storage device 503 may communicate with each other through a system bus, or communicate through other connection methods, which are not specifically limited in this embodiment of the present application.
  • the structures illustrated in the embodiments of the present application do not constitute a specific limitation of the host 50 or the storage device 503 .
  • the host 50 or the storage device 503 may include more or less components than shown, or combine some components, or separate some components, or arrange different components.
  • the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
  • the following describes the solution for improving the interaction processing efficiency between the Host and the Device in the storage system by utilizing logical out-of-band information provided by the embodiments of the present application.
  • the actions of the host 50 and the storage device 503 to perform command interaction are mainly performed by the host controller 502 and the storage controller 5032 . specifically,
  • the host controller 502 is used to establish a mapping relationship between the first context IO context information and the first identifier in the command when sending a command to the storage controller 5032, wherein the first IO context information includes the second identifier;
  • the host controller 502 is further configured to send a first data packet to the storage controller 5032, wherein the first data packet includes a first identification and a second identification;
  • the storage controller 5032 is used to receive the first data packet, and obtain the second IO context information corresponding to the second identification from the first data packet according to the first identification, and establish between the first identification and the second IO context information The mapping relationship; wherein, the first identifier is used to index the first IO context information or the second IO context information.
  • the first identifier is a newly added identifier in the technical solution provided by this application, and after the first identifier establishes a mapping relationship with the first IO context information and the second IO context information, the data exchanged between the host 50 and the storage device 503
  • the packet will carry the first identifier;
  • the second identifier is an existing identifier in the existing protocol, which is used to reverse index the IO context information in the command interaction;
  • the second IO Context information and the second IO Context information both contain the second identifier, the data packets interacted between the host 50 and the storage device 503 will all carry the second identifier.
  • the first data packet is used to initiate command interaction, that is, the host controller 502 sends the first data packet to the storage controller 5032 to notify the storage controller 5032 to start executing the command interaction, and the first identifier and the first IO context
  • the information and the second IO context information have all established a mapping relationship. After the command starts to execute, within the life cycle of this command, all data packets that are interacted between the host controller 502 and the storage controller 5032 carry the first identifier, the host After the controller 502 and the storage controller 5032 receive the data packet sent by the opposite end, they all use the first identifier carried in the data packet to index the IO context information corresponding to the data packet, and then according to the indexed IO context information Take the appropriate action.
  • the host controller 502 when sending a command to the storage controller 5032, the host controller 502 establishes a mapping relationship between the first context IO context information in the command and the first identifier, and then sends the first IO context information to the storage controller 5032.
  • the second IO context information corresponding to the second logo, and the mapping relationship between the first logo and the second IO context information is established; like this, the first logo and the first IO context information and the second IO context information have all established mapping relationship, the host controller 502 can quickly find the first IO context information through the first identifier, and the storage controller 5032 can also quickly find the second IO context information through the first identifier, thereby reducing delay overhead and improving data processing efficiency.
  • the host controller 502 since the first identifier and the first IO context information have established a mapping relationship, after the host controller 502 receives the data packet sent by the storage controller 5032, it can directly use the first identifier to To find the first IO context information, there is no need to reverse the search for the first IO context information through the second identifier.
  • the second identifier is "LUN+Task Tag+IID", and there is no need to go through the three fields of "LUN+Task Tag+IID".
  • the combination of segments finds the index address of the first IO context information, then finds the first IO context information through the index address, and directly uses the first identification as the index address of the first IO context information, through the first identification
  • the first IO context information is directly found, so that the logic for the host controller 502 to find the first IO context information becomes simple, and the time consuming for the host controller 502 to find the first IO context information is also reduced; in the storage controller 5032
  • the storage controller 5032 can directly search for the second IO context information through the first identification after receiving the data packet sent by the host controller 502, without the need for Then use the second identifier to search for the second IO context information in reverse.
  • the second identifier is "LUN+Task Tag+IID", and there is no need to find the second The index address of the IO context information, and then the second IO context information is found through the index address, and the first identifier is directly used as the index address of the second IO context information, and the second IO context information is directly found through the first identifier.
  • the logic for the storage controller 5032 to find the second IO context information is simplified, and the time-consuming for the storage controller 5032 to find the second IO context information is also reduced.
  • the embodiments of the present application can reduce delay overhead and improve data processing efficiency.
  • the command is a read command
  • the storage controller 5032 is further configured to send a second data packet to the host controller 502, wherein the second data packet includes the first identifier and the data corresponding to the read command
  • the host controller 502 is further configured to receive the second data packet, index the first IO context information according to the first identifier, and process the data corresponding to the read command according to the first IO context information.
  • the storage controller 5032 needs to send the specific data in the storage device 503 to 50, that is, the data corresponding to the read command is sent to the host 50 through the second data packet; on the host 50 side, The second data packet is received by the host controller 502, and is indexed to the first IO context information according to the first identifier in the second data packet, and the data corresponding to the read command is subsequently processed according to the first IO context information. Further, on the storage device 503 side, the data corresponding to the read command is obtained by the storage controller 5032 from a specific storage location in the storage area 5031 in the storage device 503 according to the second IO context information obtained from the first data packet of.
  • the command sent by the host controller 502 to the storage controller 5032 is a read command, and the storage controller 5032 will send a second data packet to the host controller 502;
  • the data corresponding to the command, and the first identifier and the first IO context information have established a mapping relationship.
  • the host controller 502 After receiving the second data packet, the host controller 502 searches for the first identifier according to the first identifier carried in the second data packet.
  • the context information is time-consuming, and the efficiency of processing the data corresponding to the read command is improved.
  • the second data packet further includes a second identifier; the host controller 502 is further configured to: compare the second identifier in the second data packet with the second identifier in the first IO context information Compare to perform fault-tolerant detection on the first IO context information.
  • the second identification and the first IO context information and the second IO context information have a mapping relationship
  • the first identification and the first IO context information and the second IO context information are established.
  • the mapping relationship is equivalent to establishing a mapping relationship between the first identifier and the second identifier indirectly.
  • the fault-tolerant detection here mainly completes the detection of whether the mapping relationship between the first identification and the second identification in the received second data packet and the mapping relationship between the first identification and the second identification maintained in the host controller 502 are consistent. .
  • the host controller 502 after receiving the second data packet, the host controller 502 also compares the second identifier in the second data packet with the second identifier in the first IO context information, so as to compare the first
  • the IO context information carries out fault-tolerant detection, that is, the mapping relationship between the first identifier and the second identifier in the second data packet and the first identifier and the second identifier in the first IO context information maintained in the host controller 502 are compared. Whether the mapping relationship is consistent, thereby helping to ensure that the first IO context information found according to the first identification is correct, that is, the first IO context information found according to the first identification is corresponding to the second data packet.
  • the command is a write command; the storage controller 5032 is further configured to send a third data packet to the host controller 502, wherein the third data packet includes the first identifier, and the third data packet is used for Instruct the host controller 502 to send the data corresponding to the write command to the storage controller 5032; the host controller 502 is also used to receive the third data packet, and index to the first IO context information according to the first identifier, and according to the first IO context The information sends the fourth data packet to the storage controller 5032, wherein the fourth data packet includes the data corresponding to the first identifier and the write command; the storage controller 5032 is further configured to receive the fourth data packet and index to the first identifier according to the first identifier.
  • the second IO context information, and the data corresponding to the write command is processed according to the second IO context information.
  • the command is a write command
  • the host controller 502 notifies the storage controller 5032 through the first data packet
  • the host controller 502 will send data to the storage controller 5032, and the data will be written into the storage from the host 50 side
  • the device 503 side will specifically write to a specific storage location of the storage area 5031 .
  • the host controller 502 sends the write command to the storage controller 5032, it does not directly send the data corresponding to the write command to the storage controller 5032, but waits for the third data packet sent by the storage controller 5032; the storage control The controller 5032 notifies the host controller 502 by sending a third data packet to the host controller 502 that it is ready to receive data and the amount of data that can be received; the third data packet carries the first identifier, and when the third data packet is received After the package, the host controller 502 indexes to the first IO context information through the first identifier in the third data packet, and determines which data to send to the storage controller 5032 according to the first IO context information, that is, obtains the corresponding write command.
  • the storage controller 5032 indexes to the second IO context information through the first identification in the fourth data packet, and determines the specific storage location where the data corresponding to the write command will be stored according to the second IO context information, And the data corresponding to the write command is stored in the specific storage location of the storage area 5031 .
  • the command sent by the host controller 502 to the storage controller 5032 is a write command
  • the storage controller 5032 will send a third data packet to the host controller 502, instructing the host controller 502 to send a third data packet to the storage controller 5032 Write the data corresponding to the command; because the third data packet includes the first identification, after the host controller 502 receives the third data packet, it indexes to the first IO context information according to the first identification, and stores control according to the first IO context information.
  • the device 5032 sends the fourth data packet, specifically, obtains the storage address of the data corresponding to the write command on this side according to the first IO context information, reads the data corresponding to the write command and encrypts the data, and then sends the storage control
  • the device 5032 sends the fourth data packet; since the fourth data packet includes the first identification, after the storage controller 5032 receives the fourth data packet, it indexes to the second IO context information according to the first identification, and pairs according to the second IO context information.
  • the data corresponding to the write command is processed, for example, the data corresponding to the write command is stored, etc.; for the host controller 502, since the first IO context information is searched through the first identifier, it can be reduced that the host controller 502 finds the first IO context The time-consuming information, and improve the efficiency of sending the data corresponding to the write command to the storage controller 5032; for the storage controller 5032, since the second IO context information is searched through the first identifier, the storage controller 5032 can find the second IO context information. Time-consuming IO context information, and improve the efficiency of processing the data corresponding to the write command.
  • the third data packet further includes a second identification; the host controller 502 is further configured to: compare the second identification in the third data packet with the second identification in the first IO context information Compare to perform fault-tolerant detection on the first IO context information.
  • the fourth data packet further includes a second identification; the storage controller 5032 is further configured to: compare the second identification in the fourth data packet with the second identification in the second IO context information Compare to perform fault-tolerant detection on the second IO context information.
  • the host controller 502 is further configured to acquire the first identifier from the preset identifier list stored in the host controller 502, and delete the first identifier in the preset identifier list.
  • the first identifier is a newly added identifier, a preset identifier list needs to be stored in the host controller 502, and there are multiple first identifiers in the preset identifier list.
  • the number of first identifiers cannot be less than the upper limit of the number of concurrently executed commands between the host controller 502 and the storage controller 5032; because multiple commands can be executed concurrently between the host controller 502 and the storage controller 5032, and each The initiation and execution of each command requires the use of a first identifier, that is, a first identifier is obtained from the preset identifier list. Therefore, the number of first identifiers in the preset identifier list should not be less than those that can be executed concurrently. Maximum number of commands.
  • the upper limit of the number of concurrently executed commands between the host controller 502 and the storage controller 5032 is determined by the protocol standard.
  • the first identifiers corresponding to each command cannot be the same. Therefore, after obtaining a first identifier from the preset identifier list, it is necessary to delete the preset identifier list. the first identifier in .
  • the first identifier is acquired from a preset identifier list stored in the host controller 502, and the host controller 502 acquires the first identifier from the preset identifier list when sending a command to the storage controller 5032.
  • an identifier since multiple commands may be executed concurrently between the host controller 502 and the storage controller 5032, and in order to prevent the multiple concurrently executed commands from interfering with each other, the first command corresponding to each of the multiple commands
  • the identifiers are different; therefore, for any command, after obtaining a first identifier from the preset identifier list, it is also necessary to delete the first identifier in the preset identifier list, thereby ensuring multiple concurrently executed commands.
  • the first identifier used by each command in is different, so as to ensure that multiple commands executed concurrently will not interfere with each other.
  • the storage controller 5032 is further configured to send a fifth data packet to the host controller 502, and release the mapping relationship between the first identifier and the second IO context information, wherein the fifth data packet is The package includes a first identifier, and the fifth data packet is used to indicate that the command has been executed; the host controller 502 is also used to receive the fifth data packet, write the first identifier into the preset identifier list, and release the first IO The mapping relationship between the context information and the first identifier.
  • the storage controller 5032 will automatically release the mapping relationship between the first identifier corresponding to the command and the second IO context information corresponding to the command, and the host controller 502 will automatically release the mapping relationship between the first identifier corresponding to the command and the second IO context information corresponding to the command.
  • the first identification is written in the preset identification list, and the mapping relationship between the first IO context information corresponding to the command and the first identification corresponding to the command is released, all in order to realize that the first identification can be reused; that is, After the execution of a previously executed command is completed, the first identifier corresponding to the previously executed command is recovered into the preset identifier list, which can be used by the subsequently executed command.
  • the host 50 in addition to the read command and the write command, there is also a type of command, which does not have data to read and write.
  • the host 50 sends this type of command to the storage device 503, and the storage device 503 responds directly afterwards, indicating the command The execution is complete. That is, the host controller 502 sends the first data packet to the storage controller 5032, and after receiving the first data packet, the storage controller 5032 directly sends the fifth data packet to the host controller 502.
  • the storage controller 5032 sends a fifth data packet to the host controller 502, and the fifth data packet indicates that the command of the host controller 502 has been executed, and releases the information between the first identifier and the second IO context information. Because the fifth data packet includes the first identification, after receiving the fifth data packet, the host controller 502 writes the first identification in the fifth data packet into the preset identification list, and releases the first identification The mapping relationship between the IO context information and the first identifier; because after the command execution is completed, the host controller 502 will write the first identifier into the preset identifier list, so the host controller 502 sends another message to the storage controller 5032.
  • the host controller 502 can obtain the first identifier from the preset identifier list for the execution of another command, that is, the first identifier corresponding to each command can be recycled after the execution of the command is completed. And, after the command execution is completed, the host controller 502 will release the mapping relationship between the first IO context information and the first identification, and the storage controller 5032 will release the mapping relationship between the first identification and the second IO context information , so that commands executed earlier do not interfere with other commands executed later.
  • the host controller 502 is further configured to write the first identifier into the preset identifier list when the command execution is abnormal, and release the mapping between the first IO context information and the first identifier relationship; the storage controller 5032 is further configured to release the mapping relationship between the first identifier and the second IO context information when the command execution is abnormal.
  • the host controller 502 will write the first identifier corresponding to the command into the preset identifier list, and release the command
  • the mapping relationship between the corresponding first IO context information and the first identifier corresponding to the command the storage controller 5032 also releases the mapping relationship between the first identifier corresponding to the command and the second IO context information corresponding to the command .
  • the host controller 502 when the command execution is abnormal, the host controller 502 will write the first identifier into the preset identifier list and release the mapping relationship between the first IO context information and the first identifier, and the storage controller 5032 The mapping relationship between the first identifier and the second IO context information will be released; therefore, in the case of an abnormal command execution, the first identifier corresponding to the command can also be recycled, and the abnormal execution command will not interfere with the other commands executed later.
  • the host controller 502 is specifically configured to: determine whether the number of concurrently executed commands between the host controller 502 and the storage controller 5032 reaches a preset threshold; if the preset threshold is not reached, then The first identifier is acquired from the preset identifier list, and the first identifier in the preset identifier list is deleted.
  • the host controller 502 needs to determine whether the current number of concurrently executed commands exceeds the protocol standard. upper limit. Further, the number of first identifiers in the preset identifier list is equal to the preset threshold, that is, the number of first identifiers in the preset identifier list is equal to the number of concurrently executed commands allowed by the protocol standard. .
  • the host controller 502 when the host controller 502 sends a command to the storage controller 5032, it first determines whether the number of concurrently executed commands between the host controller 502 and the storage controller 5032 reaches a preset threshold.
  • the number of concurrently executed commands between the controller 502 and the storage controller 5032 does not reach the preset threshold, that is, when the concurrency of the concurrently executed commands does not reach the upper limit, the command can be executed normally, and thus the command can be executed from the preset identification list.
  • the host controller 502 is further configured to: write the first identifier into the first data packet; use the first identifier as the index address of the COMMAND context table of the first command context, wherein the first COMMAND
  • the context table is a COMMAND context table stored in the host controller 502.
  • the first COMMAND context table includes the first IO context information corresponding to multiple concurrently executed commands, and the first identifier is used as the index address of the first COMMAND context table, so that in the command interaction process, the first identifier can be used. Find the corresponding first IO context information directly in the first COMMAND context table.
  • the host controller 502 since the host controller 502 establishes a mapping relationship between the first identifier and the first IO context information, the first identifier is written into the first data packet, and the first data packet is sent to the storage controller 5032 , then the data packets interacted between the storage controller 5032 and the host controller 502 all carry the first identification and the host controller 502 uses the first identification as the index address of the first COMMAND context table stored in the host controller 502, Thus the host controller 502 can search the first IO context information in the first COMMAND context table through the first identification carried in the data packet sent by the storage controller 5032, so as to reduce the time consuming to find the first IO context information .
  • the storage controller 5032 is further configured to: obtain the second IO context information from the second COMMAND context table according to the first identifier, wherein the second COMMAND context table is stored in the storage controller 5032 COMMAND context table in .
  • the second COMMAND context table includes the second IO context information corresponding to multiple concurrently executed commands, and the first identifier is also used as the index address of the second COMMAND context table, so that during the command interaction process, the first The identifier directly looks up the corresponding second IO context information in the second COMMAND context table.
  • the storage controller 5032 since the storage controller 5032 establishes a mapping relationship between the first identifier and the second IO context information, the first identifier is used as the index address of the second COMMAND context table stored in the storage controller 5032, and the storage After the controller 5032 receives the data packet sent by the host controller 502, it searches for the second IO context information in the second COMMAND context table through the first identifier carried in the data packet, so as to reduce the search for the second IO context time-consuming information.
  • the solutions provided in the embodiments of the present application can be applied to storage fields such as UFS, NVMe, and SAS.
  • the following takes the UFS storage field as an example, that is, the storage device 503 is a UFS storage device as an example, to introduce the solution provided by the embodiments of the present application for improving the efficiency of the interaction processing between the Host and the Device in the storage system by utilizing logical out-of-band information.
  • the command UPIU uses Byte 5 to carry the Local ID, as shown in Figure 6.
  • the solution for using logical out-of-band information to improve the interaction processing efficiency between the Host and the Device in the storage system mainly includes:
  • the originating side of the command maintains idle local IDs (Local IDs), where the total number of Local IDs is equal to the total number of concurrency of commands between UFS Host and UFS Device.
  • a Local ID is obtained and filled in the corresponding field segment of the COMMAND UPIU (add a custom field segment).
  • the initiating side of the command uses the Local ID as the index address of the IO context information corresponding to the command.
  • the receiving side of the command also uses the Local ID as the index address of the IO context information corresponding to the command.
  • FIG. 7 is a schematic flowchart of a read command interaction between a UFS Host and a UFS Device provided by an embodiment of the present application, which mainly includes the following steps:
  • the host software initiates a read command to the Host controller, that is, a COMMAND UPIU that sends a read command to the Host controller.
  • the COMMAND UPIU carries LUN, Task Tag, and IID.
  • the Host controller After receiving the COMMAND UPIU (LUN, Task Tag, IID), the Host controller assigns a free Local ID to the COMMAND UPIU (LUN, Task Tag, IID), and sends the COMMAND UPIU (LUN, IID) to the Device controller.
  • Task Tag, IID, Local ID hereinafter UPIU (LUN, Task Tag, IID, Local ID) means that UPIU carries LUN, Task Tag, IID, Local ID.
  • the Device controller After the Device controller receives the COMMAND UPIU (LUN, Task Tag, IID, Local ID), it sends DATA IN UPIU (LUN, Task Tag, IID, Local ID) to the Host controller to send a read to the Host controller. data corresponding to the command.
  • COMMAND UPIU LUN, Task Tag, IID, Local ID
  • DATA IN UPIU LUN, Task Tag, IID, Local ID
  • the Device controller sends the RESPONSE UPIU (LUN, Task Tag, IID, Local ID) to the Host controller.
  • the Host controller After the Host controller receives the RESPONSE UPIU (LUN, Task Tag, IID, Local ID), it recovers the Local ID in the RESPONSE UPIU (LUN, Task Tag, IID, Local ID).
  • the Host controller sends the RESPONSE UPIU (LUN, Task Tag, IID) to the Host Software.
  • FIG. 8 is a schematic flowchart of a write command interaction between a UFS Host and a UFS Device provided by an embodiment of the present application, which mainly includes the following steps:
  • the Host Software initiates a write command to the Host controller, that is, a COMMAND UPIU (LUN, Task Tag, IID) that sends a write command to the Host controller.
  • a COMMAND UPIU LUN, Task Tag, IID
  • the Host controller After receiving the COMMAND UPIU (LUN, Task Tag, IID), the Host controller assigns a free Local ID to the COMMAND UPIU (LUN, Task Tag, IID), and sends the COMMAND UPIU (LUN, IID) to the Device controller. Task Tag, IID, Local ID).
  • the Device controller After the Device controller receives the COMMAND UPIU (LUN, Task Tag, IID, Local ID), it sends the RTT UPIU (LUN, Task Tag, IID, Local ID) to the Host controller to instruct the Host controller to start sending data to the Device. The controller sends the data corresponding to the write command.
  • the COMMAND UPIU LUN, Task Tag, IID, Local ID
  • the RTT UPIU LUN, Task Tag, IID, Local ID
  • the Host controller After receiving the RTT UPIU (LUN, Task Tag, IID, Local ID), the Host controller sends DATA OUT UPIU (LUN, Task Tag, IID, Local ID) to the Device controller to send the Write the data corresponding to the command.
  • the Device controller sends the RESPONSE UPIU (LUN, Task Tag, IID, Local ID) to the Host controller.
  • the Host controller After the Host controller receives the RESPONSE UPIU (LUN, Task Tag, IID, Local ID), it recovers the Local ID in the RESPONSE UPIU (LUN, Task Tag, IID, Local ID).
  • the Host controller sends the RESPONSE UPIU (LUN, Task Tag, IID) to the Host Software.
  • each command can end normally, that is, for each command in the UFS protocol, the Host can receive the RESPONSE UPIU replied by the Device side, and send the corresponding command carried in the RESPONSE UPIU to the corresponding command.
  • Local ID for recycling.
  • the command execution is abnormal, the Local ID corresponding to the command also needs to be recycled.
  • abort Abort
  • the remote end that is, the Device side
  • the near-end that is, the Host side
  • the near-end completes the determination
  • the Local ID corresponding to the command can be recovered; in the UFS protocol, if the underlying link is abnormal, the Device side and the Host side are reset directly. After the reset, the Host side will still recover all the Local IDs.
  • FIG. 9 is a schematic flowchart of cooperation and interaction between a UFS Host and a UFS Device provided by an embodiment of the present application, which mainly includes the following steps.
  • the host (processor) writes the command to the command queue.
  • the UFS Host software creates a new read command, and writes the information corresponding to the read command to the specified location of the host memory (Host Memory), that is, writes the read command to the command queue (command queue). ); wherein, the specific execution hardware is the processor in the host.
  • the host submits the command to the doorbell and writes it to the host controller.
  • the UFS Host software sets the UFS Host controller's internal command to send the Doorbell register, or updates the submission Queue (SQ) doorbell tail pointer (SQ Doorbell tail pointer), that is, the UFS Host software issues the read The Doorbell corresponding to the command or the SQ Doorbell tail pointer corresponding to the read command has been updated; wherein, the specific execution hardware is the processor in the host. After that, the UFS Host controller starts the sending scheduling of the read command.
  • SQL submission Queue
  • SQ Doorbell tail pointer submission Queue
  • the UFS Host controller starts the sending scheduling of the read command.
  • the host controller commands arbitration and assigns a free local ID.
  • the UFS Host controller will first determine whether the internal command concurrency has reached the upper limit of the concurrency that it interacts with the UFS Device. And get a Local ID from the idle local ID list (Local ID List) or the idle local ID queue (Local ID queue). Therefore, before starting the sending scheduling of the read command, the UFS Host controller will first determine whether the concurrency of the command currently interacting with the UFS Device has reached the upper limit of the concurrency. Send the schedule and assign a Local ID to the read command.
  • a Local ID list or queue is maintained, such as a first-in, first-out queue (First Input First Output, FIFO).
  • FIFO First Input First Output
  • the number of Local IDs in Local ID is the same as the total number of concurrency of commands between UFS Host and UFS Device; the total number of concurrent degrees of commands between UFS Host and UFS Device is defined by each protocol version (for example: UFS3.1 and previous versions, the concurrency is 32), or defined by the capability exchange between UFS Host and UFS Device.
  • the local ID is initialized by the logic, for example, Local ID0 ⁇ Local ID255 are written into the FIFO with a depth of 256 in sequence; assuming that the concurrency of the UTP Transfer Request between the UFS Host and the UFS Device is 256, as shown in Figure 10.
  • the host controller obtains the command.
  • the UFS Host controller reads the read command from the Host Memory, that is, reads the read command from the command queue.
  • the host controller sends the command UPIU and creates a local command context.
  • the UFS Host controller creates context information for the read command, establishes a mapping relationship between the Local ID allocated for the read command and the context information of the read command, that is, uses the Local ID corresponding to the read command as the command context table (COMMAND context), record the context information of the read command in the COMMAND context, and use the Local ID corresponding to the read command to index the context information of the read command.
  • the UFS Host controller fills the Local ID corresponding to the read command into the designated position of the COMMAND UPIU, and sends the COMMAND UPIU to the UFS Device side.
  • the context information includes: whether to enable encryption and decryption, which set of KEYs to use for encryption and decryption, and information such as a Physical Region Description Table (PRDT).
  • PRDT Physical Region Description Table
  • the UFS Host controller each time a command operation is initiated, that is, the command (COMMAND) of the UFS protocol is sent, the UFS Host controller obtains a Local ID from the Local ID list or queue, and fills it in the corresponding field segment of the COMMAND UPIU ( Add a custom field segment), and then send the COMMAND UPIU to the UFS Device controller.
  • the UFS Host side logic directly uses the Local ID as the command context information storage address index number, as shown in Figure 11.
  • all UPIUs that interact between the UFS Host side and the UFS Device side carry the Local ID; and for all received UPIUs, the UFS Host controller directly uses the Local ID carried in the UPIU to index the corresponding context. information. For example, after receiving the DATA IN UPIU, find the corresponding context information according to the Local ID in the DATA IN UPIU, and obtain the encryption and decryption information and data storage address; another example, after receiving the RESPONSE UPIU, directly find the corresponding context information according to the Local ID , to obtain the storage address where RESPONSE writes DDR.
  • all UPIUs related to the read command carry the Local ID corresponding to the read command, and the UFS Host controller can directly use the Local ID corresponding to the read command carried in the UPIU to index the context information corresponding to the read command.
  • the storage device (storage controller) creates a local command context and executes the command.
  • the UFS Device After the UFS Device receives the COMMAND UPIU from the UFS Host side, the UFS Device extracts the Local ID corresponding to the read command from the specified position in the COMMAND UPIU, and uses the Local ID corresponding to the read command as its logic to distinguish the read command.
  • the unique identifier of the command, the Local ID corresponding to the read command is used as the maintenance address of the context information of the read command, that is, the context information of the read command is recorded in the COMMAND context, and the Local ID corresponding to the read command is used as the COMMAND
  • the index address of the context is used to index the context information of the read command, thereby establishing the mapping relationship between the Local ID corresponding to the read command and the context information of the read command in the UFS Device.
  • the index relationship between the COMMAND context and the Local ID is shown in the figure 11 shown.
  • the specific context information content is determined by the implementation of the UFS Device controller; the specific execution hardware is the UFS Device controller.
  • the storage device (storage controller) sends the data input UPIU to the host controller.
  • the UFS Device sends the Data IN UPIU to the UFS Host, and fills in the Local ID corresponding to the read command in the specified position in the Data IN UPIU.
  • the specific execution hardware is the UFS Device controller.
  • the host controller queries the context for the data write address and writes the data to the data buffer.
  • the UFS Host controller After receiving the DATA IN UPIU from the UFS Device side, the UFS Host controller extracts the Local ID corresponding to the read command from the specified position in the DATA IN UPIU, and uses the Local ID corresponding to the read command to directly index the corresponding Context information, and then perform corresponding data processing (such as decryption operation, writing to Host Memory, etc.) according to the indexed context information, and then write the data into the data buffer (data buffer).
  • data processing such as decryption operation, writing to Host Memory, etc.
  • the UFS Host controller uses the Local ID in the DATA IN UPIU to directly index the context information, and then compares "LUN+Task Tag+IID" and DATA in the indexed context information. Compare the "LUN+Task Tag+IID" in the IN UPIU to perform fault-tolerant detection; that is, verify the correspondence between the "LUN+Task Tag+IID” in the DATA IN UPIU and the Local ID, and the indexed context information Check whether the correspondence between "LUN+Task Tag+IID" and Local ID is consistent.
  • the storage device (storage controller) sends a response UPIU to the host controller.
  • the UFS Device side sends the RESPONSE UPIU to the UFS Host side, and fills the Local ID of the read command into the designated position in the RESPONSE UPIU.
  • the specific execution hardware is the UFS Device controller.
  • the host controller queries the context, obtains the response write address, and writes the response.
  • the UFS Host controller After receiving the RESPONSE UPIU sent from the UFS Device side, the UFS Host controller extracts the Local ID corresponding to the read command from the designated position in the RESPONSE UPIU, and uses the Local ID corresponding to the read command to directly index to Corresponding context information, write RESPONSE to the specified location in Host Memory.
  • the host controller clears the doorbell and recycles the local ID.
  • the UFS Host controller writes the Local ID corresponding to the read command carried in the RESPONSE UPIU into the Local ID list or queue for recycling; and clears the Doorbell register bit corresponding to the command, or updates the completion queue (Completion Queue, CQ) doorbell tail pointer (CQ Doorbell tail pointer).
  • the difference between the scenario of executing the write command and the scenario of executing the read command between the UFS Host and the UFS Device is that: for the read command, after the UFS Device side receives the COMMAND UPIU, it sends the DATA IN UPIU to the Host side.
  • the UFS Host side sends the data corresponding to the read command; for the write command, after the UFS Device side receives the COMMAND UPIU, it sends the RTT UPIU to the UFS Host side to instruct the Host side to start sending the data corresponding to the write command to the UFS Device side.
  • the side After receiving the RTT UPIU, the side sends DATA OUT UPIU to the UFS Device side to send the data corresponding to the write command to the UFS Device side.
  • the other steps in the scenario where the write command is executed between the UFS Host and the UFS Device are the same as those in the scenario where the read command is executed, and are not described in detail in this application.
  • FIG. 12 is a schematic flowchart of a data processing method provided by an embodiment of the present application.
  • the data processing method is applied to an electronic device, and the electronic device includes a host controller and a storage controller; the method includes but is not limited to The following steps:
  • Step 1201 when sending a command to the storage controller, establish a mapping relationship between the first context IO context information and the first identifier in the command through the host controller, wherein the first IO context information includes the second identifier.
  • Step 1202 Send a first data packet to the storage controller through the host controller, where the first data packet includes a first identifier and a second identifier.
  • Step 1203 receive the first data packet by the storage controller, and obtain the second IO context information corresponding to the second identification from the first data packet according to the first identification, and establish between the first identification and the second IO context information.
  • the command is a read command; the method further includes: sending a second data packet to the host controller through the storage controller, wherein the second data packet includes the first identifier and the data corresponding to the read command; The second data packet is received by the host controller, and the first IO context information is indexed according to the first identifier, and the data corresponding to the read command is processed according to the first IO context information.
  • the second data packet further includes a second identifier; the method further includes: comparing the second identifier in the second data packet with the second identifier in the first IO context information by the host controller Compare to perform fault-tolerant detection on the first IO context information.
  • the command is a write command; the method further includes: sending a third data packet to the host controller through the storage controller, wherein the third data packet includes the first identifier, and the third data packet is used for Instruct the host controller to send the data corresponding to the write command to the storage controller; receive the third data packet through the host controller, and index to the first IO context information according to the first identifier, and send to the storage controller according to the first IO context information
  • the fourth data packet wherein the fourth data packet includes the data corresponding to the first identification and the write command; the fourth data packet is received by the storage controller, and is indexed to the second IO context information according to the first identification, and according to the second IO
  • the context information processes the data corresponding to the write command.
  • the third data packet further includes a second identifier; the method further includes: comparing the second identifier in the third data packet with the second identifier in the first IO context information through the host controller Compare to perform fault-tolerant detection on the first IO context information.
  • the fourth data packet further includes a second identifier; the method further includes: comparing the second identifier in the fourth data packet with the second identifier in the second IO context information by the storage controller Compare to perform fault-tolerant detection on the second IO context information.
  • the method further includes: acquiring, through the host controller, the first identifier from a preset identifier list stored in the host controller, and deleting the first identifier in the preset identifier list.
  • the method further includes: sending a fifth data packet to the host controller through the storage controller, and releasing the mapping relationship between the first identifier and the second IO context information, wherein the fifth data packet is The package includes the first identification, and the fifth data packet is used to indicate that the command has been executed and completed; the fifth data packet is received by the host controller, and the first identification is written in the preset identification list, and the first IO context information and the first identification are released.
  • the method further includes: when the command execution is abnormal, writing the first identifier into the preset identifier list through the host controller, and releasing the connection between the first IO context information and the first identifier Mapping relationship; when the command execution is abnormal, the mapping relationship between the first identifier and the second IO context information is released through the storage controller.
  • obtaining the first identifier from a preset identifier list stored in the host controller by the host controller, and deleting the first identifier in the preset identifier list includes: determining by the host controller Whether the number of concurrently executed commands between the host controller and the storage controller has reached the preset threshold; if the number of commands not reached the preset threshold, obtain the first identifier from the preset identifier list through the host controller, and delete the preset identifier list The first identifier in .
  • the method further includes: using the host controller to write the first identifier into the first data packet; using the host controller to use the first identifier as the index address of the first command context COMMAND context table, wherein , the first COMMAND context table is the COMMAND context table stored in the host controller.
  • the method further includes: acquiring second IO context information from a second COMMAND context table through the storage controller according to the first identifier, wherein the second COMMAND context table is stored in the storage controller COMMAND context table.
  • the host controller when sending a command to the storage controller, the host controller establishes a mapping relationship between the first context IO context information in the command and the first identifier, and then sends the command to the storage controller.
  • the first data packet Because the first data packet contains the first identification and the second identification in the first IO context information, after receiving the first data packet, the storage controller obtains from the first data packet according to the first identification
  • the second IO context information corresponding to the second logo, and the mapping relationship between the first logo and the second IO context information is established; like this, the first logo and the first IO context information and the second IO context information have all established mapping relationship, the host controller can quickly find the first IO context information through the first identifier, and the storage controller can also quickly find the second IO context information through the first identifier, thereby reducing delay overhead and improving data processing efficiency.
  • the host controller can directly search for the first identifier through the first identifier.
  • IO context information there is no need to reversely search the first IO context information through the second identifier.
  • the second identifier is "LUN+Task Tag+IID", and there is no need to pass the combination of the three fields of "LUN+Task Tag+IID”.
  • the storage controller can directly search for the second IO context information through the first identifier, and does not need to reverse the direction through the second identifier.
  • the second identifier is "LUN+Task Tag+IID"
  • the first identifier is directly used as the index address of the second IO context information
  • the second IO context information is directly found through the first identifier.
  • the storage controller finds The logic of the second IO context information is simplified, and the time-consuming for the storage controller to find the second IO context information is also reduced.
  • the embodiments of the present application can reduce delay overhead and improve data processing efficiency.
  • FIG. 13 is a schematic flowchart of another data processing method provided by an embodiment of the present application.
  • the data processing method is applied to a storage system.
  • the storage system includes a host and a storage device.
  • the host includes a host controller.
  • the storage device includes a storage controller; the method includes but is not limited to the following steps:
  • the host When sending a command to the storage device, the host establishes a mapping relationship between the first context IO context information in the command and the first identifier through the host controller; wherein the first identifier is used to index the first IO context information.
  • the host sends a first data packet to the storage device through the host controller, where the first data packet includes a first identifier and a second identifier.
  • the storage device receives the first data packet from the host through the storage controller.
  • the storage device obtains the second context IO context information corresponding to the second identification from the first data packet by the storage controller according to the first identification, and establishes a mapping relationship between the first identification and the second IO context information; wherein , the first identifier is used to index the second IO context information.
  • the command is a read command; the method further includes: the storage device sends a second data packet to the host controller through the storage controller, wherein the second data packet includes the first identifier corresponding to the read command data; the host receives the second data packet through the host controller, and indexes to the first IO context information according to the first identification, and processes the data corresponding to the read command according to the first IO context information.
  • the second data packet further includes a second identifier; the method further includes: the host uses the host controller to associate the second identifier in the second data packet with the second identifier in the first IO context information A comparison is performed to perform fault-tolerant detection on the first IO context information.
  • the command is a write command; the method further includes: the storage device sends a third data packet to the host controller through the storage controller, wherein the third data packet includes the first identifier, and the third data packet For instructing the host controller to send the data corresponding to the write command to the storage controller; the host receives the third data packet through the host controller, and indexes to the first IO context information according to the first identifier, and stores the information according to the first IO context information.
  • the controller sends the fourth data packet, wherein the fourth data packet includes the data corresponding to the first identification and the write command; the storage device receives the fourth data packet through the storage controller, and indexes to the second IO context information according to the first identification, And process the data corresponding to the write command according to the second IO context information.
  • the third data packet further includes a second identifier; the method further includes: the host uses the host controller to associate the second identifier in the third data packet with the second identifier in the first IO context information A comparison is performed to perform fault-tolerant detection on the first IO context information.
  • the fourth data packet further includes a second identifier; the method further includes: the storage device associates the second identifier in the fourth data packet with the second identifier in the second IO context information through the storage controller The identifiers are compared to perform fault-tolerant detection on the second IO context information.
  • the method further includes: the host obtains, through the host controller, the first identifier from a preset identifier list stored in the host controller, and deletes the first identifier in the preset identifier list.
  • the method further includes: the storage device sends a fifth data packet to the host controller through the storage controller, and releases the mapping relationship between the first identifier and the second IO context information, wherein the first The five data packets include the first identifier, and the fifth data packet is used to indicate that the command has been executed; the host receives the fifth data packet through the host controller, writes the first identifier into the preset identifier list, and releases the first IO context The mapping relationship between the information and the first identifier.
  • the method further includes: when the command execution is abnormal, the host writes the first identifier into the preset identifier list through the host controller, and releases the connection between the first IO context information and the first identifier The mapping relationship; when the command execution is abnormal, the storage device releases the mapping relationship between the first identifier and the second IO context information through the storage controller.
  • the host obtains the first identifier from the preset identifier list stored in the host controller through the host controller, and deletes the first identifier in the preset identifier list, including: the host controls the host through the host controller.
  • the controller determines whether the number of concurrently executed commands between the host controller and the storage controller reaches the preset threshold; if the number of commands that are concurrently executed between the host controller and the storage controller does not reach the preset threshold, the host obtains the first identifier from the preset identifier list through the host controller, and deletes the preset threshold. Set the first ID in the ID list.
  • the method further includes: the host writes the first identifier into the first data packet through the host controller; the host uses the host controller to use the first identifier as the index address of the first command context COMMAND context table , wherein the first COMMAND context table is the COMMAND context table stored in the host controller.
  • the method further includes: the storage device obtains the second IO context information from the second COMMAND context table through the storage controller according to the first identifier, wherein the second COMMAND context table is stored in the storage controller COMMAND context table in the server.
  • the host controller when sending a command to the storage controller, the host controller establishes a mapping relationship between the first context IO context information in the command and the first identifier, and then sends the command to the storage controller.
  • the first data packet Because the first data packet contains the first identification and the second identification in the first IO context information, after receiving the first data packet, the storage controller obtains from the first data packet according to the first identification
  • the second IO context information corresponding to the second logo, and the mapping relationship between the first logo and the second IO context information is established; like this, the first logo and the first IO context information and the second IO context information have all established mapping relationship, the host controller can quickly find the first IO context information through the first identifier, and the storage controller can also quickly find the second IO context information through the first identifier, thereby reducing delay overhead and improving data processing efficiency.
  • the host controller can directly search for the first identifier through the first identifier.
  • IO context information there is no need to reversely search the first IO context information through the second identifier.
  • the second identifier is "LUN+Task Tag+IID", and there is no need to pass the combination of the three fields of "LUN+Task Tag+IID”.
  • the storage controller can directly search for the second IO context information through the first identifier, and does not need to reverse the direction through the second identifier.
  • the second identifier is "LUN+Task Tag+IID"
  • the first identifier is directly used as the index address of the second IO context information
  • the second IO context information is directly found through the first identifier.
  • the storage controller finds The logic of the second IO context information is simplified, and the time-consuming for the storage controller to find the second IO context information is also reduced.
  • the embodiments of the present application can reduce delay overhead and improve data processing efficiency.
  • An embodiment of the present application further provides an electronic device, including: a host and a storage device coupled to the host; the host is any one of the hosts in the foregoing embodiments; and the storage device is any one of the storage devices in the foregoing embodiments.
  • Embodiments of the present application further provide an electronic device, including a processor, a memory, a communication interface, and one or more programs, where the one or more programs are stored in the memory and configured to be executed by the processor, and the above-mentioned one or more programs are configured to be executed by the above-mentioned processor.
  • the program includes instructions for executing the steps in any one of the data processing methods described in the above method embodiments.
  • An embodiment of the present application further provides a chip, where the chip includes: a processor for calling and running a computer program from a memory, so that a device installed with the chip executes any one of the data processing methods described in the above method embodiments some or all of the steps.
  • Embodiments of the present application further provide a computer-readable storage medium, wherein the computer-readable storage medium may store a program, and when the program is executed by an electronic device, a host, or a storage device, the program includes any of the methods described in the foregoing method embodiments. Some or all of the steps of a data processing method.
  • the embodiments of the present application further provide a computer program, the computer program includes instructions, when the computer program is executed by an electronic device, a host or a storage device, the electronic device, the host or the storage device can execute any of the methods described in the foregoing method embodiments. Some or all of the steps of a data processing method.
  • the disclosed apparatus may be implemented in other manners.
  • the device embodiments described above are only illustrative.
  • the division of the above-mentioned units is only a logical function division.
  • multiple units or components may be combined or integrated. to another system, or some features can be ignored, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical or other forms.
  • the above-mentioned units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
  • the integrated units are implemented in the form of software functional units and sold or used as independent products, they may be stored in a computer-readable storage medium.
  • the technical solutions of the present application can be embodied in the form of software products in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, and the computer software products are stored in a storage medium , including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc., specifically a processor in the computer device) to execute all or part of the steps of the foregoing methods in the various embodiments of the present application.
  • a computer device which may be a personal computer, a server, or a network device, etc., specifically a processor in the computer device
  • the aforementioned storage medium may include: U disk, mobile hard disk, magnetic disk, optical disk, Read-Only Memory (Read-Only Memory, abbreviation: ROM) or Random Access Memory (Random Access Memory, abbreviation: RAM), etc.
  • a medium that can store program code may include: U disk, mobile hard disk, magnetic disk, optical disk, Read-Only Memory (Read-Only Memory, abbreviation: ROM) or Random Access Memory (Random Access Memory, abbreviation: RAM), etc.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本申请实施例提供了一种数据处理方法及相关设备,该方法包括:向存储控制器发送命令时,通过主机控制器建立命令中的第一上下文IO context信息与第一标识之间的映射关系,其中,第一IO context信息包括第二标识;通过主机控制器向存储控制器发送第一数据包,其中,第一数据包包括第一标识和第二标识;通过存储控制器接收第一数据包,并根据第一标识从第一数据包中获取与第二标识对应的第二IO context信息,以及建立第一标识与第二IO context信息之间的映射关系;其中,第一标识用于索引第一IO context信息或第二IO context信息。采用本申请实施例,可以减少延时开销,提升数据处理的效率。

Description

数据处理方法及相关设备 技术领域
本申请涉及数据处理技术领域,尤其涉及一种数据处理方法及相关设备。
背景技术
在通用闪存存储(Universal Flash Storage,UFS)协议中,区分一个输入输出(IO)的唯一标识为“逻辑单元编号(Logical Unit Number,LUN)+任务标签(Task Tag)+发起者编号(Initiator ID,IID)”。在实际的UFS系统中,UFS主机(UFS Host)和UFS存储设备(UFS Device)之间的命令的并发度有限,例如UFS3.1版本以及更早版本的UFS协议中,UFS传输协议(UFS transport protocol,UTP)传输请求(UTP Transfer Request)的并发度为32,UFS Host和UFS Device逻辑内部会维护32个并发命令的上下文(IO context)信息,UFS Host和UFS Device每次在接收到对端的UFS协议信息单元(UFS Protocol Information Units,UPIU)后,使用“LUN+Task Tag+IID”三个域段的组合来反向查找其归属于32个上下文信息中的哪一个;也即使用“LUN+Task Tag+IID”三个域段的组合来查找该上下文信息的索引地址,然后通过该索引地址查找到该上下文信息。
由于UFS Host和UFS Device逻辑,在命令的整个交互流程中,每收到对端发来的一个UPIU后,都需要使用“LUN+Task Tag+IID”反向查找到对应的上下文信息,操作复杂且耗时。若UFS Host和UFS Device之间的UTP Transfer Request的并发度越大,依据“LUN+Task Tag+IID”反向查找到对应的上下文信息的逻辑就越庞大且耗时越长,从而影响整个UFS系统的命令交互的延时。
综上,UFS Host和UFS Device在接收到UPIU后,如何简单且快速高效地查找到本端维护的上下文信息,是一个迫切需要解决的问题。
发明内容
本申请实施例提供了一种数据处理方法及相关设备,以减少延时开销,提升数据处理的效率。
第一方面,本申请实施例提供了一种数据处理装置,包括:主机控制器和存储控制器;主机控制器,用于向存储控制器发送命令时,建立命令中的第一上下文IO context信息与第一标识之间的映射关系,其中,第一IO context信息包括第二标识;主机控制器,还用于向存储控制器发送第一数据包,其中,第一数据包包括第一标识和第二标识;存储控制器,用于接收第一数据包,并根据第一标识从第一数据包中获取与第二标识对应的第二IO context信息,以及建立第一标识与第二IO context信息之间的映射关系;其中,第一标识用于索引第一IO context信息或第二IO context信息。在本申请实施例中,主机控制器在向存储控制器发送命令时,建立该命令中的第一上下文IO context信息与第一标识之间的映射关系,然后向存储控制器发送第一数据包;由于第一数据包中包含第一标识和第一IO context信息中的第二标识,存储控制器在接收到第一数据包后,根据第一标识从第一数据 包中获取与第二标识对应的第二IO context信息,以及建立第一标识与第二IO context信息之间的映射关系;如此,第一标识与第一IO context信息和第二IO context信息均建立了映射关系,主机控制器可以通过该第一标识快速查找到第一IO context信息,存储控制器也可以通过该第一标识快速查找到第二IO context信息,从而可以减少延时开销,提升数据处理的效率。具体地,在主机控制器侧,由于第一标识与第一IO context信息建立了映射关系,主机控制器在接收到存储控制器发来的数据包后,可以通过第一标识直接去查找第一IO context信息,无需再通过第二标识去反向查找第一IO context信息,例如第二标识是“LUN+Task Tag+IID”,无需通过“LUN+Task Tag+IID”三个域段的组合来查找该第一IO context信息的索引地址,然后通过该索引地址来查找到该第一IO context信息,而直接将第一标识作为第一IO context信息的索引地址,通过第一标识直接查找到第一IO context信息,如此,主机控制器查找到第一IO context信息的逻辑变简单,且主机控制器查找到第一IO context信息的耗时也减少;在存储控制器侧,由于第一标识与第二IO context信息建立了映射关系,存储控制器在接收到主机控制器发来的数据包后,可以通过第一标识直接去查找第二IO context信息,无需再通过第二标识去反向查找第二IO context信息,例如第二标识是“LUN+Task Tag+IID”,无需通过“LUN+Task Tag+IID”三个域段的组合来查找该第二IO context信息的索引地址,然后通过该索引地址来查找到该第二IO context信息,而直接将第一标识作为第二IO context信息的索引地址,通过第一标识直接查找到第二IO context信息,如此,存储控制器查找到第二IO context信息的逻辑变简单,且存储控制器查找到第二IO context信息的耗时也减少。综上,本申请实施例,可以减少延时开销,提升数据处理的效率。
在一种可能的实现方式中,命令为读命令;存储控制器,还用于向主机控制器发送第二数据包,其中,第二数据包包括第一标识和读命令对应的数据;主机控制器,还用于接收第二数据包,并根据第一标识索引到第一IO context信息,以及根据第一IO context信息对读命令对应的数据进行处理。在本申请实施例中,当主机控制器向存储控制器发送的命令为读命令时,则存储控制器会向主机控制器发送第二数据包;由于第二数据包包括第一标识和读命令对应的数据,且第一标识与第一IO context信息建立了映射关系,因此主机控制器在接收到第二数据包之后,根据第二数据包中的携带的第一标识去查找到第一IO context信息,再根据第一IO context信息对读命令对应的数据进行处理,例如根据第一IO context信息对读命令对应的数据进行解密、存储等,从而减少主机控制器查找到第一IO context信息的耗时,且提升对读命令对应的数据进行处理的效率。
在一种可能的实现方式中,第二数据包还包括第二标识;主机控制器,还用于:将第二数据包中的第二标识与第一IO context信息中的第二标识进行比对,以对第一IO context信息进行容错检测。在本申请实施例中,主机控制器在接收到第二数据包后,还将第二数据包中的第二标识与第一IO context信息中的第二标识进行比对,以对第一IO context信息进行容错检测,也即比对第二数据包中的第一标识和第二标识的映射关系和主机控制器中维护的第一IO context信息中的第一标识和第二标识的映射关系是否一致,从而有利于确保根据第一标识查找到的第一IO context信息是正确的,也即根据第一标识查找到的第一IO context信息与第二数据包是对应的。
在一种可能的实现方式中,命令为写命令;存储控制器,还用于向主机控制器发送第三数据包,其中,第三数据包包括第一标识,第三数据包用于指示主机控制器向存储控制器发送写命令对应的数据;主机控制器,还用于接收第三数据包,并根据第一标识索引到第一IO context信息,以及根据第一IO context信息向存储控制器发送第四数据包,其中,第四数据包包括第一标识和写命令对应的数据;存储控制器,还用于接收第四数据包,并根据第一标识索引到第二IO context信息,以及根据第二IO context信息对写命令对应的数据进行处理。在本申请实施例中,当主机控制器向存储控制器发送的命令为写命令,则存储控制器会向主机控制器发送第三数据包,指示主机控制器向存储控制器发送写命令对应的数据;由于第三数据包包括第一标识,主机控制器接收到第三数据包后,根据第一标识索引到第一IO context信息,以及根据第一IO context信息向存储控制器发送第四数据包,具体地,根据第一IO context信息获取写命令对应的数据在本侧的存储地址,读取写命令对应的数据并对该数据进行加密等操作,然后向存储控制器发送第四数据包;由于第四数据包包括第一标识,存储控制器接收到第四数据包后,根据第一标识索引到第二IO context信息,以及根据第二IO context信息对写命令对应的数据进行处理,例如对写命令对应的数据进行存储等;对于主机控制器,由于通过第一标识查找第一IO context信息,从而可以减少主机控制器查找到第一IO context信息的耗时,且提升向存储控制器发送写命令对应的数据的效率;对于存储控制器,由于通过第一标识查找第二IO context信息,从而可以减少存储控制器查找到第二IO context信息的耗时,且提升对写命令对应的数据进行处理的效率。
在一种可能的实现方式中,第三数据包还包括第二标识;主机控制器,还用于:将第三数据包中的第二标识与第一IO context信息中的第二标识进行比对,以对第一IO context信息进行容错检测。
在一种可能的实现方式中,第四数据包还包括第二标识;存储控制器,还用于:将第四数据包中的第二标识与第二IO context信息中的第二标识进行比对,以对第二IO context信息进行容错检测。
在一种可能的实现方式中,主机控制器,还用于从存储于主机控制器中的预设标识清单中获取第一标识,并删除预设标识清单中的第一标识。在本申请实施例中,第一标识是从存储于主机控制器中的预设标识清单中获取的,主机控制器在向存储控制器发送命令时,从预设标识清单中获取第一标识;由于主机控制器与存储控制器之间可能并发执行多个命令,而为使并发执行的多个命令不会相互干扰,这多个命令中的每个命令所对应的第一标识是不同的;因此,对于任意一个命令,从预设标识清单中获取到一个第一标识后,还需要将预设标识清单中的该第一标识删除,从而可以确保并发执行的多个命令中的每个命令所采用的第一标识是不同的,以此来确保并发执行的多个命令不会相互干扰。
在一种可能的实现方式中,存储控制器,还用于向主机控制器发送第五数据包,以及释放第一标识与第二IO context信息之间的映射关系,其中,第五数据包包括第一标识,第五数据包用于指示命令已执行完成;主机控制器,还用于接收第五数据包,并将第一标识写入预设标识清单中,以及释放第一IO context信息与第一标识之间的映射关系。在本申请实施例中,存储控制器向主机控制器发送第五数据包,通过第五数据包指示主机控制 器命令已执行完成,以及释放第一标识与第二IO context信息之间的映射关系;由于第五数据包包括第一标识,主机控制器在接收到第五数据包后,并将第五数据包中的第一标识写入预设标识清单中,以及释放第一IO context信息与第一标识之间的映射关系;因为在命令执行完成后,主机控制器会将第一标识写入预设标识清单中,因此主机控制器在向存储控制器发送另外一个命令时,主机控制器又可以从预设标识清单中获取该第一标识,用于另外一个命令的执行,也即每个命令对应的第一标识在该命令执行完成以后可以被回收利用;并且,在命令执行完成后,主机控制器会释放第一IO context信息与第一标识之间的映射关系,存储控制器会释放第一标识与第二IO context信息之间的映射关系,从而在先执行的命令不会干扰在后执行的其他命令。
在一种可能的实现方式中,主机控制器,还用于当命令执行异常时,将第一标识写入预设标识清单中,以及释放第一IO context信息与第一标识之间的映射关系;存储控制器,还用于当命令执行异常时,释放第一标识与第二IO context信息之间的映射关系。在本申请实施例中,当命令执行异常时,主机控制器会将第一标识写入预设标识清单中以及释放第一IO context信息与第一标识之间的映射关系,存储控制器会释放第一标识与第二IO context信息之间的映射关系;因此在命令执行异常的情况下,该命令对应的第一标识也可以被回收利用,并且该执行异常的命令也不会干扰在后执行的其他命令。
在一种可能的实现方式中,主机控制器,具体用于:判断主机控制器与存储控制器之间并发执行的命令的数量是否达到预设阈值;若未达到预设阈值,则从预设标识清单中获取第一标识,并删除预设标识清单中的第一标识。进一步地,预设标识清单中的第一标识的数量和该预设阈值是相等的。在本申请实施例中,主机控制器在向存储控制器发送命令时,先判断主机控制器与存储控制器之间并发执行的命令的数量是否达到预设阈值,只有当主机控制器与存储控制器之间并发执行的命令的数量未达到预设阈值时,也即并发执行的命令的并发度没有达到上限时,才能正常执行该命令,从而才会从预设标识清单中获取第一标识,并删除预设标识清单中的第一标识,以此来确保该命令可以正常执行。
在一种可能的实现方式中,主机控制器,还用于:将第一标识写入第一数据包;将第一标识作为第一命令上下文COMMAND context表的索引地址,其中,第一COMMAND context表为存储于主机控制器中的COMMAND context表。在本申请实施例中,由于主机控制器建立了第一标识与第一IO context信息的映射关系,将第一标识写入第一数据包,并将第一数据包发送给存储控制器,之后存储控制器与主机控制器之间交互的数据包都携带了第一标识并且主机控制器将第一标识作为存储于主机控制器中的第一COMMAND context表的索引地址,从而主机控制器可以通过存储控制器发来的数据包中携带的第一标识在第一COMMAND context表中查找第一IO context信息,以此可以减少查找到第一IO context信息的耗时。
在一种可能的实现方式中,存储控制器,还用于:根据第一标识从第二COMMAND context表中获取第二IO context信息,其中,第二COMMAND context表为存储于存储控制器中的COMMAND context表。在本申请实施例中,由于存储控制器建立了第一标识与第二IO context信息的映射关系,将第一标识作为存储于存储控制器中的第二COMMAND context表的索引地址,存储控制器接收到主机控制器发来的数据包后,通过该数据包中携 带的第一标识在第二COMMAND context表中查找第二IO context信息,以此可以减少查找到第二IO context信息的耗时。
第二方面,本申请实施例提供了一种主机,包括主机控制器;主机控制器,用于:向存储设备发送命令时,建立命令中的第一上下文IO context信息与第一标识之间的映射关系;其中,第一标识用于索引第一IO context信息。
在一种可能的实现方式中,主机控制器,还用于:向存储设备发送第一数据包,其中,第一数据包包括第一标识。
在一种可能的实现方式中,命令为读命令;主机控制器,还用于:接收来自存储设备的第二数据包,其中,第二数据包包括第一标识和读命令对应的数据;根据第一标识索引到第一IO context信息,以及根据第一IO context信息对读命令对应的数据进行处理。
在一种可能的实现方式中,第二数据包还包括第二标识,第一IO context信息包括第二标识;主机控制器,还用于:将第二数据包中的第二标识与第一IO context信息中的第二标识进行比对,以对第一IO context信息进行容错检测。
在一种可能的实现方式中,命令为写命令;主机控制器,还用于:接收来自存储设备的第三数据包,其中,第三数据包包括第一标识,第三数据包用于指示主机向存储设备发送写命令对应的数据;根据第一标识索引到第一IO context信息,以及根据第一IO context信息向存储设备发送第四数据包,其中,第四数据包包括第一标识和写命令对应的数据。
在一种可能的实现方式中,第三数据包还包括第二标识;主机控制器,还用于:将第三数据包中的第二标识与第一IO context信息中的第二标识进行比对,以对第一IO context信息进行容错检测。
在一种可能的实现方式中,主机控制器,还用于:从存储于主机控制器中的预设标识清单中获取第一标识,并删除预设标识清单中的第一标识。
在一种可能的实现方式中,主机控制器,还用于:接收来自存储设备的第五数据包,其中,第五数据包包括第一标识,第五数据包用于指示命令已执行完成;将第一标识写入预设标识清单中,以及释放第一IO context信息与第一标识之间的映射关系。
在一种可能的实现方式中,主机控制器,还用于:当命令执行异常时,将第一标识写入预设标识清单中,以及释放第一IO context信息与第一标识之间的映射关系。
在一种可能的实现方式中,主机控制器,具体用于:判断主机与存储设备之间并发执行的命令的数量是否达到预设阈值;若未达到预设阈值,则从预设标识清单中获取第一标识,并删除预设标识清单中的第一标识。
在一种可能的实现方式中,主机控制器,还用于:将第一标识写入第一数据包;将第一标识作为第一命令上下文COMMAND context表的索引地址,其中,第一COMMAND context表为存储于主机控制器中的COMMAND context表。
第三方面,本申请实施例提供了一种存储设备,包括存储控制器;存储控制器,用于:接收来自主机的第一数据包,其中,第一数据包包括第一标识和第二标识;根据第一标识从第一数据包中获取与第二标识对应的第二上下文IO context信息,以及建立第一标识与 第二IO context信息之间的映射关系;其中,第一标识用于索引第二IO context信息。
在一种可能的实现方式中,第一数据包为读命令对应的数据包;存储控制器,还用于:向主机发送第二数据包,其中,第二数据包包括第一标识和读命令对应的数据。
在一种可能的实现方式中,第一数据包为写命令对应的数据包;存储控制器,还用于:向主机发送第三数据包,其中,第三数据包包括第一标识,第三数据包用于指示主机向存储设备发送写命令对应的数据;接收来自主机的第四数据包,其中,第四数据包包括第一标识和写命令对应的数据;根据第一标识索引到第二IO context信息,以及根据第二IO context信息对写命令对应的数据进行处理。
在一种可能的实现方式中,第四数据包还包括第二标识;存储控制器,还用于:将第四数据包中的第二标识与第二IO context信息中的第二标识进行比对,以对第二IO context信息进行容错检测。
在一种可能的实现方式中,存储控制器,还用于:向主机发送第五数据包,以及释放第一标识与第二IO context信息之间的映射关系,其中,第五数据包包括第一标识,第五数据包用于指示命令已执行完成。
在一种可能的实现方式中,存储控制器,还用于:当命令执行异常时,释放第一标识与第二IO context信息之间的映射关系。
在一种可能的实现方式中,存储控制器,还用于:根据第一标识从第二命令上下文COMMAND context表中获取第二IO context信息,其中,第二COMMAND context表为存储于存储控制器中的COMMAND context表。
第四方面,本申请实施例提供了一种电子设备,包括:主机以及耦合于主机的存储设备;主机为上述第二方面任意一项所描述的主机;存储设备为上述第三方面任意一项所描述的存储设备。
第五方面,本申请实施例提供了一种数据处理方法,应用于电子设备,该电子设备包括主机控制器和存储控制器;该方法包括:向存储控制器发送命令时,通过主机控制器建立命令中的第一上下文IO context信息与第一标识之间的映射关系,其中,第一IO context信息包括第二标识;通过主机控制器向存储控制器发送第一数据包,其中,第一数据包包括第一标识和第二标识;通过存储控制器接收第一数据包,并根据第一标识从第一数据包中获取与第二标识对应的第二IO context信息,以及建立第一标识与第二IO context信息之间的映射关系;其中,第一标识用于索引第一IO context信息或第二IO context信息。
在一种可能的实现方式中,命令为读命令;该方法还包括:通过存储控制器向主机控制器发送第二数据包,其中,第二数据包包括第一标识和读命令对应的数据;通过主机控制器接收第二数据包,并根据第一标识索引到第一IO context信息,以及根据第一IO context信息对读命令对应的数据进行处理。
在一种可能的实现方式中,第二数据包还包括第二标识;该方法还包括:通过主机控制器将第二数据包中的第二标识与第一IO context信息中的第二标识进行比对,以对第一IO context信息进行容错检测。
在一种可能的实现方式中,命令为写命令;该方法还包括:通过存储控制器向主机控制器发送第三数据包,其中,第三数据包包括第一标识,第三数据包用于指示主机控制器向存储控制器发送写命令对应的数据;通过主机控制器接收第三数据包,并根据第一标识索引到第一IO context信息,以及根据第一IO context信息向存储控制器发送第四数据包,其中,第四数据包包括第一标识和写命令对应的数据;通过存储控制器接收第四数据包,并根据第一标识索引到第二IO context信息,以及根据第二IO context信息对写命令对应的数据进行处理。
在一种可能的实现方式中,第三数据包还包括第二标识;该方法还包括:通过主机控制器将第三数据包中的第二标识与第一IO context信息中的第二标识进行比对,以对第一IO context信息进行容错检测。
在一种可能的实现方式中,第四数据包还包括第二标识;该方法还包括:通过存储控制器将第四数据包中的第二标识与第二IO context信息中的第二标识进行比对,以对第二IO context信息进行容错检测。
在一种可能的实现方式中,该方法还包括:通过主机控制器从存储于主机控制器中的预设标识清单中获取第一标识,并删除预设标识清单中的第一标识。
在一种可能的实现方式中,该方法还包括:通过存储控制器向主机控制器发送第五数据包,以及释放第一标识与第二IO context信息之间的映射关系,其中,第五数据包包括第一标识,第五数据包用于指示命令已执行完成;通过主机控制器接收第五数据包,并将第一标识写入预设标识清单中,以及释放第一IO context信息与第一标识之间的映射关系。
在一种可能的实现方式中,该方法还包括:当命令执行异常时,通过主机控制器将第一标识写入预设标识清单中,以及释放第一IO context信息与第一标识之间的映射关系;以及通过存储控制器释放第一标识与第二IO context信息之间的映射关系。
在一种可能的实现方式中,通过主机控制器从存储于主机控制器中的预设标识清单中获取第一标识,并删除预设标识清单中的第一标识,包括:通过主机控制器判断主机控制器与存储控制器之间并发执行的命令的数量是否达到预设阈值;若未达到预设阈值,则通过主机控制器从预设标识清单中获取第一标识,并删除预设标识清单中的第一标识。
在一种可能的实现方式中,该方法还包括:通过主机控制器将第一标识写入第一数据包;通过主机控制器将第一标识作为第一命令上下文COMMAND context表的索引地址,其中,第一COMMAND context表为存储于主机控制器中的COMMAND context表。
在一种可能的实现方式中,该方法还包括:通过存储控制器根据第一标识从第二COMMAND context表中获取第二IO context信息,其中,第二COMMAND context表为存储于存储控制器中的COMMAND context表。
第六方面,本申请实施例提供了一种数据处理方法,应用于主机,该主机包括主机控制器;该方法包括:向存储设备发送命令时,通过主机控制器建立命令中的第一上下文IO context信息与第一标识之间的映射关系;其中,第一标识用于索引第一IO context信息。
在一种可能的实现方式中,该方法还包括:通过主机控制器向存储设备发送第一数据包,其中,第一数据包包括第一标识。
在一种可能的实现方式中,命令为读命令;该方法还包括:通过主机控制器接收来自存储设备的第二数据包,其中,第二数据包包括第一标识和读命令对应的数据;通过主机控制器根据第一标识索引到第一IO context信息,以及根据第一IO context信息对读命令对应的数据进行处理。
在一种可能的实现方式中,第二数据包还包括第二标识,第一IO context信息包括第二标识;该方法还包括:通过主机控制器将第二数据包中的第二标识与第一IO context信息中的第二标识进行比对,以对第一IO context信息进行容错检测。
在一种可能的实现方式中,命令为写命令;该方法还包括:通过主机控制器接收来自存储设备的第三数据包,其中,第三数据包包括第一标识,第三数据包用于指示主机向存储设备发送写命令对应的数据;通过主机控制器根据第一标识索引到第一IO context信息,以及根据第一IO context信息向存储设备发送第四数据包,其中,第四数据包包括第一标识和写命令对应的数据。
在一种可能的实现方式中,第三数据包还包括第二标识;该方法还包括:通过主机控制器将第三数据包中的第二标识与第一IO context信息中的第二标识进行比对,以对第一IO context信息进行容错检测。
在一种可能的实现方式中,该方法还包括:通过主机控制器从存储于主机控制器中的预设标识清单中获取第一标识,并删除预设标识清单中的第一标识。
在一种可能的实现方式中,该方法还包括:通过主机控制器接收来自存储设备的第五数据包,其中,第五数据包包括第一标识,第五数据包用于指示命令已执行完成;通过主机控制器将第一标识写入预设标识清单中,以及释放第一IO context信息与第一标识之间的映射关系。
在一种可能的实现方式中,该方法还包括:当命令执行异常时,通过主机控制器将第一标识写入预设标识清单中,以及释放第一IO context信息与第一标识之间的映射关系。
在一种可能的实现方式中,通过主机控制器从存储于主机控制器中的预设标识清单中获取第一标识,并删除预设标识清单中的第一标识,包括:通过主机控制器判断主机与存储设备之间并发执行的命令的数量是否达到预设阈值;若未达到预设阈值,则通过主机控制器从预设标识清单中获取第一标识,并删除预设标识清单中的第一标识。
在一种可能的实现方式中,该方法还包括:通过主机控制器将第一标识写入第一数据包;通过主机控制器将第一标识作为第一命令上下文COMMAND context表的索引地址,其中,第一COMMAND context表为存储于主机控制器中的COMMAND context表。
第七方面,本申请实施例提供了一种数据处理方法,应用于存储设备,该存储设备包括存储控制器;该方法包括:通过存储控制器接收来自主机的第一数据包,其中,第一数据包包括第一标识和第二标识;通过存储控制器根据第一标识从第一数据包中获取与第二标识对应的第二上下文IO context信息,以及建立第一标识与第二IO context信息之间的映射关系;其中,第一标识用于索引第二IO context信息。
在一种可能的实现方式中,第一数据包为读命令对应的数据包;该方法还包括:通过存储控制器向主机发送第二数据包,其中,第二数据包包括第一标识和读命令对应的数据。
在一种可能的实现方式中,第一数据包为写命令对应的数据包;该方法还包括:通过存储控制器向主机发送第三数据包,其中,第三数据包包括第一标识,第三数据包用于指示主机向存储设备发送写命令对应的数据;通过存储控制器接收来自主机的第四数据包,其中,第四数据包包括第一标识和写命令对应的数据;通过存储控制器根据第一标识索引到第二IO context信息,以及根据第二IO context信息对写命令对应的数据进行处理。
在一种可能的实现方式中,第四数据包还包括第二标识;该方法还包括:通过存储控制器将第四数据包中的第二标识与第二IO context信息中的第二标识进行比对,以对第二IO context信息进行容错检测。
在一种可能的实现方式中,该方法还包括:通过存储控制器向主机发送第五数据包,以及释放第一标识与第二IO context信息之间的映射关系,其中,第五数据包包括第一标识,第五数据包用于指示命令已执行完成。
在一种可能的实现方式中,该方法还包括:当命令执行异常时,通过存储控制器释放第一标识与第二IO context信息之间的映射关系。
在一种可能的实现方式中,该方法还包括:通过存储控制器根据第一标识从第二命令上下文COMMAND context表中获取第二IO context信息,其中,第二COMMAND context表为存储于存储控制器中的COMMAND context表。
第八方面,本申请实施例提供了一种电子设备,包括处理器、存储器、通信接口,以及一个或多个程序,上述一个或多个程序被存储在上述存储器中,并且被配置由上述处理器执行,上述程序包括用于执行如上述第五方面中任一项所述的方法中的步骤的指令。
第九方面,本申请实施例提供了一种芯片,包括:处理器,用于从存储器中调用并运行计算机程序,使得安装有所述芯片的设备执行上述第五方面或第六方面或第七方面中任一项所述的方法。
第十方面,本申请实施例提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机程序,该计算机程序被执行时实现上述第五方面或第六方面或第七方面中任意一项所述的数据处理方法流程。
第十一方面,本申请实施例提供了一种计算机程序,该计算机程序包括指令,当该计算机程序被执行时,实现上述第五方面或第六方面或第七方面中任意一项所述的数据处理方法流程。
附图说明
图1是本申请实施例提供的一种UFS协议中的UPIU的数据结构示意图。
图2是本申请实施例提供的一种UFS Host和UFS Device内部维护的命令上下文信息的数据结构示意图。
图3是本申请实施例提供的一种UFS Host内部接收到UPIU的处理流程示意图。
图4是本申请实施例提供的一种UFS Device内部接收到UPIU的处理流程示意图。
图5是本申请实施例提供的一种主机和存储设备的结构示意图。
图6是本申请实施例提供的一种UPIU的数据结构示意图。
图7是本申请实施例提供的一种UFS Host和UFS Device之间执行读命令交互的流程示意图。
图8是本申请实施例提供的一种UFS Host和UFS Device之间执行写命令交互的流程示意图。
图9是本申请实施例提供的一种UFS Host和UFS Device之间配合交互的流程示意图。
图10是本申请实施例提供的一种空闲的本地ID(Local ID)队列的示意图。
图11是本申请实施例提供的一种上下文信息表的示意图。
图12是本申请实施例提供的一种数据处理方法的流程示意图。
图13是本申请实施例提供的另一种数据处理方法的流程示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例进行描述。本申请的说明书和权利要求书及所述附图中的术语“第一”、“第二”、“第三”和“第四”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。
在本说明书中使用的术语“部件”、“模块”、“系统”等用于表示计算机相关的实体、硬件、固件、硬件和软件的组合、软件、或执行中的软件。例如,部件可以是但不限于,在处理器上运行的进程、处理器、对象、可执行文件、执行线程、程序和/或计算机。通过图示,在计算设备上运行的应用和计算设备都可以是部件。一个或多个部件可驻留在进程和/或执行线程中,部件可位于一个计算机上和/或分布在2个或更多个计算机之间。此外,这些部件可从在上面存储有各种数据结构的各种计算机可读介质执行。部件可例如根据具有一个或多个数据分组(例如来自与本地系统、分布式系统和/或网络间的另一部件交互的二个部件的数据,例如通过信号与其它系统交互的互联网)的信号通过本地和/或远程进程来通信。
首先,对本申请实施例中涉及的相关知识进行解释说明,以便于本领域技术人员理解。
请参阅图1,图1是本申请实施例提供的一种UFS协议中的UPIU的数据结构示意图。如图1所示,在UFS协议中,区分一个IO的唯一标识为“LUN+Task Tag+IID”,具体地,LUN用于区分命令前往不同的逻辑单元(LU),Task Tag为某主机下发至某个LU对应的IO的标签(Tag)号,IID用于区分不同的主机。对于UFS协议中的任意一个命令,该命 令的整个交互流程中,所有的UPIU传输都需要携带“LUN+Task Tag+IID”这几个信息,用于对端识别唯一的一个IO。在UFS Host侧和UFS Device侧,每接收到对端发过来的一个UPIU,都需要使用“LUN+Task Tag+IID”三个域段的组合来查找到与其对应的上下文信息;也即使用“LUN+Task Tag+IID”三个域段的组合来查找该上下文信息的索引地址,然后通过该索引地址查找到该上下文信息。
其次,为了便于理解本申请实施例,进一步分析并提出本申请所具体要解决的技术问题。目前,UFS协议标准未定义额外的机制来提升该场景下的处理效率,命令交互中都使用“LUN+Task Tag+IID”作为唯一的标识符。按照UFS标准协议定义的帧格式和交互流程,无论哪个厂家实现,其UFS Host控制器和UFS Device控制器内部都少不了通过“LUN+Task Tag+IID”来反向查找该命令的上下文信息的逻辑。
请参阅图2,图2是本申请实施例提供的一种UFS Host和UFS Device内部维护的命令上下文信息的数据结构示意图。如图2所示,根据UFS协议的定义,当前普遍的一种实现方案为:在UFS Host控制器和UFS Device控制器内部,为每个命令维护一组上下文信息;例如,在UFS3.1及比其更早的版本,UTP Transfer Request的并发度为32,则UFS Host控制器和UFS Device控制器内部需要维护32组命令上下文信息。
请参阅图3,图3是本申请实施例提供的一种UFS Host内部接收到UPIU的处理流程示意图。具体包括以下步骤。
301、UFS Host逻辑收到一个准备转移UPIU(RTTUPIU)/数据输入UPIU(DATA IN UPIU)/响应UPIU(RESPONSE UPIU)。
302、根据LUN+Task Tag+IID去搜索匹配,也即获取该UPIU对应哪一组上下文。
303、获取本端搜索匹配到的上下文信息,比如物理区域描述表(Physical Region Description Table,PRDT)、加解密、DDR地址等信息。
304、执行后续操作。
请参阅图4,图4是本申请实施例提供的一种UFS Device内部接收到UPIU的处理流程示意图。具体包括以下步骤。
401、UFS Device逻辑收到一个数据输出UPIU(DATA OUTUPIU)。
402、根据LUN+Task Tag+IID去搜索匹配,也即获取该UPIU对应哪一组上下文。
403、获取本端搜索匹配到的上下文信息,比如对应数据写缓存(Buffer)地址等信息。
404、执行后续操作。
由图3和图4可知,在UFS Host控制器和UFS Device控制器接收到对端发来的UPIU后,在UFS Host和UFS Device内部都需要对接收到的该UPIU进行反向搜索匹配命令上下文的查找操作。
综上,现有技术中的技术缺陷,主要包括以下几个方面:
1、UFS Host和UFS Device控制器逻辑,在整个命令交互流程中,每收到对端发送的一个UPIU帧,都需要使用“LUN+Task Tag+IID”反向搜索到对应的上下文信息,操作复杂且耗时。
2、当UFS Host和UFS Device之间的UTP Transfer Request并发度越大,依据“LUN+Task Tag+IID”反向搜索上下文信息的逻辑越庞大且耗时越长,影响整个命令交互的延时。
因此,本申请所要解决的技术问题可以包括如下:
UFS Host和UFS Device在接收到UPIU后,如何简单且快速高效地查找到本端维护的上下文信息,从而提高UPIU接收后的交互效率,减少延时开销。
基于上述分析,本申请实施例提供一种主机和存储设备。
请参见图5,图5为本申请实施例提供的一种主机和存储设备的结构示意图,该主机50可以为任何产生数据的计算设备,如服务器、个人计算机、平板电脑、手机、个人数字助理、智能穿戴设备等各类设备;存储设备503可以是任何为主机50提供存储/读取数据功能的非易失性存储器。在本申请实施例中,存储设备503可以内置于主机50中,也可与主机50分别为独立的设备,还可以是存储设备503和主机50共同位于一个电子设备中,本申请对此不做具体限定。主机50或存储设备503具体可以是芯片或芯片组或搭载有芯片或者芯片组的电路板,该芯片或芯片组或搭载有芯片或芯片组的电路板可在必要的软件驱动下工作。具体地,
主机50,可包括处理器(central processing unit,CPU)500、内存储器501。可选的,还可以包括主机控制器502,进一步地,还可以包括图5中未示出的电源、其他输入输出控制器和接口等应用处理侧的所有物理器件。其中,
处理器500:可运行操作系统、文件系统(如闪存文件系统F2FS)或应用程序等,以控制连接到处理器500的多个硬件或软件元件,并且可处理各种数据并执行操作。处理器500可将存储设备503中存储的指令或数据加载到内存储器501中,并把需要运算的指令或数据调到处理器500中进行运算,当运算完成后处理器500再将结果临时存储在内存储器501中,并将需要长期存储的指令或数据通过主机控制器502存储至存储设备503中。处理器500可以包括一个或多个处理单元(也可称处理核),例如:处理器500可以包括中央处理单元(CPU)、应用处理单元(application processor,AP)、调制解调处理单元、图形处理单元(graphics processing unit,GPU)、图像信号处理单元(image signal processor,ISP)、视频编解码单元、数字信号处理单元(digital signal processor,DSP)、基带处理单元和神经网络处理单元(neural-network processing unit,NPU)等中的一个或多个。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个器件中。可选的,处理器500中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器500中的存储器为高速缓冲存储器(Cache)。所述Cache可以保存处理器500刚用过或循环使用的指令或数据。如果处理器500需要再次使用该指令或数据,可从所述Cache中直接调用。避免了重复存取,减少了处理器500的等待时间,因而提高了系统的效率。进一步地,处理器500还可被实现为片上系统(System on Chip,SoC)。
内存储器501,通常为掉电易失性存储器,断电时会丢失其上存储的内容,也可称为内存(Memory)或主存储器。本申请中的内存储器501包括可读可写的运行内存,其作用是用于暂时存放处理器500中的运算数据,以及与存储设备503或其他外部存储器交互数据,可作为操作系统或其他正在运行中的程序的临时数据的存储媒介。例如,运行于处理器500上的操作系统把需要运算的数据从内存储器501调到处理器500中进行运算,当运算完成后处理器500再将结果传送出来。
内存储器501可以包括,动态随机存取存储器(DRAM)、静态随机存取存储器(SRAM)、同步动态随机存取存储器(SDRAM)等中的一种或多种。其中,DRAM又包括双倍速率同步动态随机存储器(Double Data Rate Synchronous Dynamic Random Access Memory,DDR SDRAM)简称DDR、二代双倍速率同步动态随机存储器(DDR2)、三代双倍速率同步动态随机存储器(DDR3)、四代低功耗双倍数据率同步动态随机存储器(Low Power Double Data Rate 4,LPDDR4)和五代低功耗双倍数据率同步动态随机存储器(Low Power Double Data Rate 5,LPDDR5)等。
主机控制器502,用于管理并控制主机50与存储设备503之间的通信,并为主机50和存储设备503之间的通信提供标准化(例如通用闪存存储UFS标准)的接口。具体地,主机控制器502可以根据处理器500发出的读/写等请求,向存储设备503传递命令(例如,写入、读取、擦除等命令)及数据,以及根据存储设备503读/写数据等结果向主机50反馈事件(如命令完成事件、命令状态事件、硬件出错事件等)。对于从处理器500发出的命令或数据,主机控制器502可将命令或数据通过封装的方式转换为支持某个协议的数据包,而对于主机50接收的数据主机控制器502则进行反向操作。可选的,一个主机可以支持多个主机控制器(Host Controller),以支持与不同协议的存储设备之间的通信。在本申请实施例中,主机控制器502根据主机50与存储设备503之间所支持的协议(例如UFS协议)生成本申请中所涉及的写命令、读命令,擦除命令等。可选的,该主机控制器502的功能也可以集成在处理器500中,即由处理器500完成主机控制器502的上述功能,此处不作具体限定。
存储设备503至少包括一存储区域5031。进一步地,该存储设备503还可以包括存储控制器5032。其中,
存储设备503,为非易失性存储器,断电后其存储的内容不会丢失。存储设备503(包括存储区域5031)可用于长期存储主机50运行所涉及的指令和数据,如启动程序、操作系统、应用程序和数据等。由于主机50中的处理器500不能直接读取存储设备503中的指令和数据也不能直接向存储设备503写入指令或数据,因此,处理器500在执行读(或加载)命令时,实际上是通过主机控制器502将存储在存储设备503中的待读内容(包括指令和/或数据)先临时加载至内存储器501中,然后再由处理器500从内存储器501中读出;而在执行写(即存储)命令时,实际上是由处理器500先将待存储数据(包括指令和/或数据)临时写入至内存储器501中,然后再通过主机控制器502从内存储器501存储至存储设备503中。所以,存储设备503的性能如读速率、写速率、擦除速率、擦写次数、数据保持能力等,对主机50的性能影响非常大,决定了主机50或主机50所在的电子设备是否能正常、稳定、高效的运行。
存储设备503可以包括通用闪存存储器(universal flash storage,UFS)、快速非易失性存储(Non-Volatile Memory Express,NVMe)、序列式小型计算机系统接口(Serial Attached Small Computer System Interface,SAS)存储、Flash闪存(例如,NAND闪存、NOR闪存等)、嵌入式多媒体卡eMMC、通用闪存存储多芯片封装uMCP存储器、嵌入式多媒体卡多芯片封装eMCP存储器、固态驱动器(SSD)等中的一个或多个。进一步地,存储设备503还可以包括其他存储介质如机械硬盘(Hard Disk Drive,HDD)等。
存储控制器5032,是主机50与存储设备503的接口设备,其作用主要就是进行接口的转换,将主机50(例如主机50中的主机控制器)发出的读、写、删除等命令转换成存储设备503能够识别的信号,还可以完成主机50与存储设备503之间地址译码(例如,主机50逻辑地址和存储设备503中物理地址之间的映射)、数据格式的转换(比如数据位宽)等。总之,存储控制器5032可以按照一定的时序规则对其所在的存储设备503的访问进行必要控制的设备,包括地址信号、数据信号以及各种命令信号的控制,使主机50能够根据需求使用存储设备503上的存储资源。例如,存储控制器5032接收并解析主机50中的主机控制器502发送的读命令或写命令等,并根据读命令或写命令等中携带的数据的逻辑地址,将数据的逻辑地址根据固定地址映射关系解析为物理地址,进而查找待读或者待写数据的位置,并最终向存储区域5031发出与命令对应的控制信号。
可以理解的是,处理器500与内存储器501、主机控制器和存储设备503之间可以通过系统总线的方式相互通信,也可以通过其他连接方式进行通信,本申请实施例对此不作具体限定。本申请实施例示意的结构并不构成主机50或存储设备503的具体限定。在本申请另一些实施例中,主机50或存储设备503可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
下面结合图5示出的主机50和存储设备503的结构,介绍本申请实施例提供的利用逻辑带外信息提升存储系统中Host和Device交互处理效率的方案。在本申请实施例提供的方案中,主机50与存储设备503进行命令交互的动作主要由主机控制器502和存储控制器5032执行。具体地,
主机控制器502,用于向存储控制器5032发送命令时,建立命令中的第一上下文IO context信息与第一标识之间的映射关系,其中,第一IO context信息包括第二标识;
主机控制器502,还用于向存储控制器5032发送第一数据包,其中,第一数据包包括第一标识和第二标识;
存储控制器5032,用于接收第一数据包,并根据第一标识从第一数据包中获取与第二标识对应的第二IO context信息,以及建立第一标识与第二IO context信息之间的映射关系;其中,第一标识用于索引第一IO context信息或第二IO context信息。
应理解,第一标识为本申请提供的技术方案中新增的标识,第一标识与第一IO context信息和第二IO context信息建立映射关系之后,主机50与存储设备503之间交互的数据包均会携带该第一标识;第二标识为现有协议中已有的标识,其用于命令交互中反向索引IO context信息;第二IO Context信息和第二IO Context信息均包含第二标识,主机50与存储设备503之间交互的数据包均会携带该第二标识。第一数据包用于发起命令的交互,也即主机控制器502通过向存储控制器5032发送第一数据包,以此来通知存储控制器5032开始执行命令交互,第一标识与第一IO context信息和第二IO context信息均建立了映射关系,命令开始执行以后,在这个命令的生命周期内,主机控制器502和存储控制器5032之间交互的所有数据包均携带该第一标识,主机控制器502和存储控制器5032在接收到对端发来的数据包后,均通过该数据包中携带的第一标识来索引该数据包对应的IO context信息, 进而根据索引到的IO context信息进行相应的操作。
在本申请实施例中,主机控制器502在向存储控制器5032发送命令时,建立该命令中的第一上下文IO context信息与第一标识之间的映射关系,然后向存储控制器5032发送第一数据包;由于第一数据包中包含第一标识和第一IO context信息中的第二标识,存储控制器5032在接收到第一数据包后,根据第一标识从第一数据包中获取与第二标识对应的第二IO context信息,以及建立第一标识与第二IO context信息之间的映射关系;如此,第一标识与第一IO context信息和第二IO context信息均建立了映射关系,主机控制器502可以通过该第一标识快速查找到第一IO context信息,存储控制器5032也可以通过该第一标识快速查找到第二IO context信息,从而可以减少延时开销,提升数据处理的效率。具体地,在主机控制器502侧,由于第一标识与第一IO context信息建立了映射关系,主机控制器502在接收到存储控制器5032发来的数据包后,可以通过第一标识直接去查找第一IO context信息,无需再通过第二标识去反向查找第一IO context信息,例如第二标识是“LUN+Task Tag+IID”,无需通过“LUN+Task Tag+IID”三个域段的组合来查找该第一IO context信息的索引地址,然后通过该索引地址来查找到该第一IO context信息,而直接将第一标识作为第一IO context信息的索引地址,通过第一标识直接查找到第一IO context信息,如此,主机控制器502查找到第一IO context信息的逻辑变简单,且主机控制器502查找到第一IO context信息的耗时也减少;在存储控制器5032侧,由于第一标识与第二IO context信息建立了映射关系,存储控制器5032在接收到主机控制器502发来的数据包后,可以通过第一标识直接去查找第二IO context信息,无需再通过第二标识去反向查找第二IO context信息,例如第二标识是“LUN+Task Tag+IID”,无需通过“LUN+Task Tag+IID”三个域段的组合来查找该第二IO context信息的索引地址,然后通过该索引地址来查找到该第二IO context信息,而直接将第一标识作为第二IO context信息的索引地址,通过第一标识直接查找到第二IO context信息,如此,存储控制器5032查找到第二IO context信息的逻辑变简单,且存储控制器5032查找到第二IO context信息的耗时也减少。综上,本申请实施例,可以减少延时开销,提升数据处理的效率。
在一种可能的实现方式中,命令为读命令;存储控制器5032,还用于向主机控制器502发送第二数据包,其中,第二数据包包括第一标识和读命令对应的数据;主机控制器502,还用于接收第二数据包,并根据第一标识索引到第一IO context信息,以及根据第一IO context信息对读命令对应的数据进行处理。
应理解,当命令为读命令,故存储控制器5032需要将存储设备503中的特定数据发送给50,也即将该读命令对应的数据通过第二数据包发送给主机50;在主机50侧,由主机控制器502接收该第二数据包,并根据第二数据包中的第一标识索引到第一IO context信息,以及根据第一IO context信息对该读命令对应的数据进行后续处理。进一步地,在存储设备503侧,该读命令对应的数据是由存储控制器5032根据从第一数据包中获取的第二IO context信息从存储设备503中的存储区域5031中的特定存储位置获取的。
在本申请实施例中,主机控制器502向存储控制器5032发送的命令为读命令,存储控制器5032会向主机控制器502发送第二数据包;由于第二数据包包括第一标识和读命令对应的数据,且第一标识与第一IO context信息建立了映射关系,主机控制器502在接收到 第二数据包之后,根据第二数据包中的携带的第一标识去查找到第一IO context信息,再根据第一IO context信息对读命令对应的数据进行处理,例如根据第一IO context信息对读命令对应的数据进行解密、存储等,从而减少主机控制器502查找到第一IO context信息的耗时,且提升对读命令对应的数据进行处理的效率。
在一种可能的实现方式中,第二数据包还包括第二标识;主机控制器502,还用于:将第二数据包中的第二标识与第一IO context信息中的第二标识进行比对,以对第一IO context信息进行容错检测。
应理解,在现有协议中,第二标识与第一IO context信息和第二IO context信息是存在映射关系,而本方案中建立了第一标识与第一IO context信息和第二IO context信息的映射关系,也就相当于第一标识和第二标识间接建立了映射关系。此处的容错检测,主要完成所接收到的第二数据包中的第一标识和第二标识的映射关系和主机控制器502中维护的第一标识和第二标识的映射关系是否一致的检测。
在本申请实施例中,主机控制器502在接收到第二数据包后,还将第二数据包中的第二标识与第一IO context信息中的第二标识进行比对,以对第一IO context信息进行容错检测,也即比对第二数据包中的第一标识和第二标识的映射关系和主机控制器502中维护的第一IO context信息中的第一标识和第二标识的映射关系是否一致,从而有利于确保根据第一标识查找到的第一IO context信息是正确的,也即根据第一标识查找到的第一IO context信息与第二数据包是对应的。
在一种可能的实现方式中,命令为写命令;存储控制器5032,还用于向主机控制器502发送第三数据包,其中,第三数据包包括第一标识,第三数据包用于指示主机控制器502向存储控制器5032发送写命令对应的数据;主机控制器502,还用于接收第三数据包,并根据第一标识索引到第一IO context信息,以及根据第一IO context信息向存储控制器5032发送第四数据包,其中,第四数据包包括第一标识和写命令对应的数据;存储控制器5032,还用于接收第四数据包,并根据第一标识索引到第二IO context信息,以及根据第二IO context信息对写命令对应的数据进行处理。
应理解,当命令为写命令,也即主机控制器502通过第一数据包通知存储控制器5032,主机控制器502将会向存储控制器5032发送数据,该数据将要从主机50侧写入存储设备503侧,具体地将写入存储区域5031的特定存储位置。然而,主机控制器502向存储控制器5032发送写命令后,并不会直接向存储控制器5032发送该写命令对应的数据,而是等待存储控制器5032发来的第三数据包;存储控制器5032通过向主机控制器502发送第三数据包来告知主机控制器502,其已经准备好接收数据以及可以接收的数据量;第三数据包是携带第一标识的,在接收到第三数据包后,主机控制器502通过第三数据包中的第一标识索引到第一IO context信息,并根据第一IO context信息确定向存储控制器5032发送哪些数据,也即获取到该写命令对应的数据,以及可选地对该写命令对应的数据进行加密,再通过第四数据包将该写命令对应的数据发送给存储控制器5032;第四数据包是携带第一标识的,在接收到第四数据包后,存储控制器5032通过第四数据包中的第一标识索引到第二IO context信息,并根据第二IO context信息确定该写命令对应的数据将要存储的特定存储位置,以及将该写命令对应的数据存储在存储区域5031的该特定存储位置。
在本申请实施例中,主机控制器502向存储控制器5032发送的命令为写命令,存储控制器5032会向主机控制器502发送第三数据包,指示主机控制器502向存储控制器5032发送写命令对应的数据;由于第三数据包包括第一标识,主机控制器502接收到第三数据包后,根据第一标识索引到第一IO context信息,以及根据第一IO context信息向存储控制器5032发送第四数据包,具体地,根据第一IO context信息获取写命令对应的数据在本侧的存储地址,读取写命令对应的数据并对该数据进行加密等操作,然后向存储控制器5032发送第四数据包;由于第四数据包包括第一标识,存储控制器5032接收到第四数据包后,根据第一标识索引到第二IO context信息,以及根据第二IO context信息对写命令对应的数据进行处理,例如对写命令对应的数据进行存储等;对于主机控制器502,由于通过第一标识查找第一IO context信息,从而可以减少主机控制器502查找到第一IO context信息的耗时,且提升向存储控制器5032发送写命令对应的数据的效率;对于存储控制器5032,由于通过第一标识查找第二IO context信息,从而可以减少存储控制器5032查找到第二IO context信息的耗时,且提升对写命令对应的数据进行处理的效率。
在一种可能的实现方式中,第三数据包还包括第二标识;主机控制器502,还用于:将第三数据包中的第二标识与第一IO context信息中的第二标识进行比对,以对第一IO context信息进行容错检测。
在一种可能的实现方式中,第四数据包还包括第二标识;存储控制器5032,还用于:将第四数据包中的第二标识与第二IO context信息中的第二标识进行比对,以对第二IO context信息进行容错检测。
在一种可能的实现方式中,主机控制器502,还用于从存储于主机控制器502中的预设标识清单中获取第一标识,并删除预设标识清单中的第一标识。
应理解,由于第一标识是新增的标识,因此需要在主机控制器502中存储预设标识清单,该预设标识清单中有多个第一标识,具体的,该预设标识清单中的第一标识的数量不能少于主机控制器502与存储控制器5032之间并发执行的命令的数量上限;因为主机控制器502与存储控制器5032之间是可以并发执行多个命令的,而每个命令的发起执行,都需要用到一个第一标识,也即从该预设标识清单中获取一个第一标识,故预设标识清单中的第一标识的数量应不少于可并发执行的命令的数量上限。其中,主机控制器502与存储控制器5032之间并发执行的命令的数量上限由协议标准决定。并且,为使并发执行的多个命令不会相互干扰,故每个命令所对应的第一标识不能相同,因此从预设标识清单中获取了一个第一标识后,还需要删除预设标识清单中的该第一标识。
在本申请实施例中,第一标识是从存储于主机控制器502中的预设标识清单中获取的,主机控制器502在向存储控制器5032发送命令时,从预设标识清单中获取第一标识;由于主机控制器502与存储控制器5032之间可能并发执行多个命令,而为使并发执行的多个命令不会相互干扰,这多个命令中的每个命令所对应的第一标识是不同的;因此,对于任意一个命令,从预设标识清单中获取到一个第一标识后,还需要将预设标识清单中的该第一标识删除,从而可以确保并发执行的多个命令中的每个命令所采用的第一标识是不同的,以此来确保并发执行的多个命令不会相互干扰。
在一种可能的实现方式中,存储控制器5032,还用于向主机控制器502发送第五数据 包,以及释放第一标识与第二IO context信息之间的映射关系,其中,第五数据包包括第一标识,第五数据包用于指示命令已执行完成;主机控制器502,还用于接收第五数据包,并将第一标识写入预设标识清单中,以及释放第一IO context信息与第一标识之间的映射关系。
应理解,某个命令执行完成以后,存储控制器5032会自动释放该命令对应的第一标识与该命令对应的第二IO context信息之间的映射关系,主机控制器502会将该命令对应的第一标识写入预设标识清单中,以及释放该命令对应的第一IO context信息与该命令对应的第一标识之间的映射关系,均是为了实现该第一标识可以重复利用;也即当某个在先执行的命令执行完成以后,将该在先执行的命令对应的第一标识回收到预设标识清单中,可供在后执行的命令使用。
需要说明的是,在协议应用中,除了读命令和写命令,还有一类命令,其没有数据读写,主机50给存储设备503发送了这类命令,存储设备503后续直接回复响应,指示命令执行完成。也即,主机控制器502向存储控制器5032发送第一数据包,存储控制器5032接收到第一数据包后,直接向主机控制器502发送第五数据包。
在本申请实施例中,存储控制器5032向主机控制器502发送第五数据包,通过第五数据包指示主机控制器502命令已执行完成,以及释放第一标识与第二IO context信息之间的映射关系;由于第五数据包包括第一标识,主机控制器502在接收到第五数据包后,并将第五数据包中的第一标识写入预设标识清单中,以及释放第一IO context信息与第一标识之间的映射关系;因为在命令执行完成后,主机控制器502会将第一标识写入预设标识清单中,因此主机控制器502在向存储控制器5032发送另外一个命令时,主机控制器502又可以从预设标识清单中获取该第一标识,用于另外一个命令的执行,也即每个命令对应的第一标识在该命令执行完成以后可以被回收利用;并且,在命令执行完成后,主机控制器502会释放第一IO context信息与第一标识之间的映射关系,存储控制器5032会释放第一标识与第二IO context信息之间的映射关系,从而在先执行的命令不会干扰在后执行的其他命令。
在一种可能的实现方式中,主机控制器502,还用于当命令执行异常时,将第一标识写入预设标识清单中,以及释放第一IO context信息与第一标识之间的映射关系;存储控制器5032,还用于当命令执行异常时,释放第一标识与第二IO context信息之间的映射关系。
应理解,为使任何一个第一标识都可以回收利用,即使在命令执行异常的情况下,主机控制器502也会将该命令对应的第一标识写入预设标识清单中,以及释放该命令对应的第一IO context信息与该命令对应的第一标识之间的映射关系,存储控制器5032也会释放该命令对应的第一标识与该命令对应的第二IO context信息之间的映射关系。
在本申请实施例中,当命令执行异常时,主机控制器502会将第一标识写入预设标识清单中以及释放第一IO context信息与第一标识之间的映射关系,存储控制器5032会释放第一标识与第二IO context信息之间的映射关系;因此在命令执行异常的情况下,该命令对应的第一标识也可以被回收利用,并且该执行异常的命令也不会干扰在后执行的其他命令。
在一种可能的实现方式中,主机控制器502,具体用于:判断主机控制器502与存储控制器5032之间并发执行的命令的数量是否达到预设阈值;若未达到预设阈值,则从预设标识清单中获取第一标识,并删除预设标识清单中的第一标识。
应理解,并发执行的命令的数量超过协议标准规定的上限是不允许的,因此每个新触发的命令在执行前,主机控制器502需要判断当前并发执行的命令的数量是否超过协议标准规定的上限。进一步地,预设标识清单中的第一标识的数量和该预设阈值是相等的,也即预设标识清单中的第一标识的数量与协议标准允许的并发执行的命令的数量是相等的。
在本申请实施例中,主机控制器502在向存储控制器5032发送命令时,先判断主机控制器502与存储控制器5032之间并发执行的命令的数量是否达到预设阈值,只有当主机控制器502与存储控制器5032之间并发执行的命令的数量未达到预设阈值时,也即并发执行的命令的并发度没有达到上限时,才能正常执行该命令,从而才会从预设标识清单中获取第一标识,并删除预设标识清单中的第一标识,以此来确保该命令可以正常执行。
在一种可能的实现方式中,主机控制器502,还用于:将第一标识写入第一数据包;将第一标识作为第一命令上下文COMMAND context表的索引地址,其中,第一COMMAND context表为存储于主机控制器502中的COMMAND context表。
应理解,第一COMMAND context表中包括并发执行的多个命令对应的第一IO context信息,将第一标识作为第一COMMAND context表的索引地址,从而在命令交互过程中,可以通过第一标识直接在第一COMMAND context表查找对应的第一IO context信息。
在本申请实施例中,由于主机控制器502建立了第一标识与第一IO context信息的映射关系,将第一标识写入第一数据包,并将第一数据包发送给存储控制器5032,之后存储控制器5032与主机控制器502之间交互的数据包都携带了第一标识并且主机控制器502将第一标识作为存储于主机控制器502中的第一COMMAND context表的索引地址,从而主机控制器502可以通过存储控制器5032发来的数据包中携带的第一标识在第一COMMAND context表中查找第一IO context信息,以此可以减少查找到第一IO context信息的耗时。
在一种可能的实现方式中,存储控制器5032,还用于:根据第一标识从第二COMMAND context表中获取第二IO context信息,其中,第二COMMAND context表为存储于存储控制器5032中的COMMAND context表。
应理解,第二COMMAND context表中包括并发执行的多个命令对应的第二IO context信息,同时第一标识也作为第二COMMAND context表的索引地址,从而在命令交互过程中,可以通过第一标识直接在第二COMMAND context表查找对应的第二IO context信息。
在本申请实施例中,由于存储控制器5032建立了第一标识与第二IO context信息的映射关系,将第一标识作为存储于存储控制器5032中的第二COMMAND context表的索引地址,存储控制器5032接收到主机控制器502发来的数据包后,通过该数据包中携带的第一标识在第二COMMAND context表中查找第二IO context信息,以此可以减少查找到第二IO context信息的耗时。
应理解,本申请实施例提供的方案可以应用于UFS、NVMe、SAS等存储领域。下面 以UFS存储领域为例,也即以存储设备503为UFS存储设备为例,介绍本申请实施例提供的利用逻辑带外信息提升存储系统中Host和Device交互处理效率的方案。
具体地,UFS Host和UFS Device在命令交互流程中,每收到一个UPIU帧,不需要再使用“LUN+Task Tag+IID”反向搜索到对应的IO context信息,直接使用UPIU中携带的新增信息进行命令对应的IO context信息读取,省去反向匹配搜索的操作,进而减少逻辑实现复杂度,提高帧交互效率。与UFS现有协议对比,针对UFS Host与UFS Device之间交互的UPIU,需要额外增加一个域段,用于携带UFS Host侧逻辑为该命令分配的本地空闲ID(Local ID),在该命令交互的整个流程中,所有的UPIU都需要携带该Local ID,UFS Host侧和UFS Device侧均通过该Local ID来索引命令对应的IO context信息。其中,Local ID具体配置在UPIU内部哪个位置,可以统一固定在一个位置,或者根据不同的UPIU选择放置不同位置。例如,命令UPIU(COMMAND UPIU)利用Byte 5来携带Local ID,如图6所示。该利用逻辑带外信息提升存储系统中Host和Device交互处理效率的方案主要包括:
1、命令的发起侧,维护有空闲的本地ID(Local ID),其中,Local ID的总数量与UFS Host和UFS Device之间的命令的并发度总数相等。
2、命令的发起侧每发起一个命令的操作,例如UFS协议的COMMAND发送,则获取一个Local ID,将其填入到COMMAND UPIU的对应域段(新增自定义域段)。
3、命令的发起侧使用该Local ID作为该命令对应的IO context信息的索引地址。
4、命令的接收侧也使用该Local ID作为该命令对应的IO context信息的索引地址。
5、该命令的生命周期内,命令的发起侧与命令的接收侧之间交互的所有UPIU都要将该Local ID作为带外信息进行携带。
6、当该命令执行完成后,命令的发起侧将该Local ID进行回收利用。
如上描述的方案要点,在UFS系统中UFS Host和UFS Device之间的交互流程示意图如下图7和图8所示。
请参阅图7,图7是本申请实施例提供的一种UFS Host和UFS Device之间执行读命令交互的流程示意图,主要包括以下步骤:
1、主机软件(Host Software)向Host控制器发起一个读命令,也即向Host控制器发送一个读命令的COMMAND UPIU,该COMMAND UPIU携带有LUN、Task Tag、IID,下文以UPIU(LUN,Task Tag,IID)表示UPIU携带有LUN、Task Tag、IID。
2、Host控制器接收到该COMMAND UPIU(LUN,Task Tag,IID)后,给该COMMAND UPIU(LUN,Task Tag,IID)分配一个空闲的Local ID,并向Device控制器发送COMMAND UPIU(LUN,Task Tag,IID,Local ID),下文以UPIU(LUN,Task Tag,IID,Local ID)表示UPIU携带有LUN、Task Tag、IID、Local ID。
3、Device控制器接收到该COMMAND UPIU(LUN,Task Tag,IID,Local ID)后,向Host控制器发送DATA IN UPIU(LUN,Task Tag,IID,Local ID),以向Host控制器发送读命令对应的数据。
4、当读命令对应的数据发送完成时,Device控制器向Host控制器发送RESPONSE UPIU(LUN,Task Tag,IID,Local ID)。
5、Host控制器接收到该RESPONSE UPIU(LUN,Task Tag,IID,Local ID)后,回收该RESPONSE UPIU(LUN,Task Tag,IID,Local ID)中的该Local ID。
6、Host控制器向Host Software发送RESPONSE UPIU(LUN,Task Tag,IID)。
请参阅图8,图8是本申请实施例提供的一种UFS Host和UFS Device之间执行写命令交互的流程示意图,主要包括以下步骤:
1、Host Software向Host控制器发起一个写命令,也即向Host控制器发送一个写命令的COMMAND UPIU(LUN,Task Tag,IID)。
2、Host控制器接收到该COMMAND UPIU(LUN,Task Tag,IID)后,给该COMMAND UPIU(LUN,Task Tag,IID)分配一个空闲的Local ID,并向Device控制器发送COMMAND UPIU(LUN,Task Tag,IID,Local ID)。
3、Device控制器接收到该COMMAND UPIU(LUN,Task Tag,IID,Local ID)后,向Host控制器发送RTT UPIU(LUN,Task Tag,IID,Local ID),以指示Host控制器开始向Device控制器发送写命令对应的数据。
4、Host控制器接收到该RTT UPIU(LUN,Task Tag,IID,Local ID)后,向Device控制器发送DATA OUT UPIU(LUN,Task Tag,IID,Local ID),以向Device控制器发送该写命令对应的数据。
5、当写命令对应的数据接收完成时,Device控制器向Host控制器发送RESPONSE UPIU(LUN,Task Tag,IID,Local ID)。
6、Host控制器接收到该RESPONSE UPIU(LUN,Task Tag,IID,Local ID)后,回收该RESPONSE UPIU(LUN,Task Tag,IID,Local ID)中的该Local ID。
7、Host控制器向Host Software发送RESPONSE UPIU(LUN,Task Tag,IID)。
上述定义了正常执行流程,每个命令都可以正常结束,也即对于UFS协议中的每个命令,Host都可以接收到Device侧回复的RESPONSE UPIU,并将该RESPONSE UPIU中携带的该命令对应的Local ID进行回收利用。此外,若该命令执行出现异常,同样也需要将该命令对应的Local ID进行回收利用。UFS协议中,若IO超时,会有中止(Abort)处理,具体地,先远端(也即Device侧)中止,然后近端(也即Host侧)确定(clear),在近端完成确定后可进行该命令对应的Local ID的回收;UFS协议中,若底层链路异常,直接执行Device侧和Host侧复位,复位后,Host侧依旧会将所有的Local ID回收。
下面通过UFS Host与UFS Device之间执行读命令,进一步介绍本申请实施例提供的利用逻辑带外信息提升存储系统中Host和Device交互处理效率的方案。
请参阅图9,图9是本申请实施例提供的一种UFS Host和UFS Device之间配合交互的流程示意图,主要包括以下步骤。
1、主机(处理器)将命令写入命令队列。
具体地,UFS Host软件(UFS Host Software)创建一个新的读命令,并将该读命令对应的信息写入主机内存(Host Memory)的指定位置,也即将该读命令写入命令队列(command queue)中;其中,具体的执行硬件为主机内的处理器。
2、主机(处理器)将命令提交门铃写入主机控制器。
具体地,UFS Host软件置位UFS Host控制器内部命令发送门铃(Doorbell)寄存器,或者更新提交队列(Submission Queue,SQ)门铃尾标(SQ Doorbell tail pointer),也即UFS Host软件下发该读命令对应的Doorbell或者更新了该读命令对应的SQ Doorbell tail pointer;其中,具体的执行硬件为主机内的处理器。之后,UFS Host控制器则启动该读命令的发送调度。
3、主机控制器命令仲裁并分配一个空闲的本地ID。
具体地,由于在每次启动命令发送调度之前,UFS Host控制器都会先判断内部命令并发度是否达到其与UFS Device交互的并发度上限,若未达到并发度上限,则启动一次命令发送调度,并从空闲的本地ID清单(Local ID List)或空闲的本地ID队列(Local ID queue)中获取一个Local ID。因此,在启动该读命令的发送调度之前,UFS Host控制器会先判断当前其与UFS Device之间交互的命令并发度是否达到并发度上限,若未达到并发度上限,则启动该读命令的发送调度,并给该读命令分配一个Local ID。
其中,在命令的发起侧,也即UFS Host控制器内部,维护有一个Local ID清单或队列,例如先入先出队列(First Input First Output,FIFO)。其中,Local ID中的Local ID数量与UFS Host和UFS Device之间的命令的并发度总数相同;UFS Host和UFS Device之间的命令的并发度总数由各个协议版本进行定义(例如:UFS3.1及以前版本并发度为32),或者由UFS Host和UFS Device进行能力互换来定义。UFS Host控制器复位撤离后,由逻辑对Local ID完成初始化,比如依次将Local ID0~Local ID255写入到深度为256的FIFO中;假设UFS Host和UFS Device之间的UTP Transfer Request的并发度为256,如图10所示。
4、主机控制器获取命令。
具体地,UFS Host控制器从Host Memory中读取该读命令,也即从command queue中读取该读命令。
5、主机控制器发送命令UPIU并创建本地命令上下文。
具体地,UFS Host控制器为该读命令创建上下文信息,建立为该读命令分配的Local ID与该读命令的上下文信息的映射关系,也即使用该读命令对应的Local ID作为命令上下文表(COMMAND context)的索引地址,在该COMMAND context中记录该读命令的上下文信息,采用该读命令对应的Local ID来索引该读命令的上下文信息。同时,UFS Host控制器将该读命令对应的Local ID填入到COMMAND UPIU指定位置,并向UFS Device侧发送该COMMAND UPIU。
其中,上下文信息包括:是否使能加解密,加解密所采用哪一组KEY,以及物理区域描述表(Physical Region Description Table,PRDT)等信息。
应理解,每发起一个命令的操作,也即UFS协议的命令(COMMAND)发送,UFS Host控制器则从Local ID清单或队列里面获取一个Local ID,将其填入到COMMAND UPIU的对应域段(新增自定义域段),再向UFS Device控制器发送该COMMAND UPIU。同时,UFS Host侧逻辑内部直接使用该Local ID作为该命令上下文信息存储地址索引号,如图11所示。之后,UFS Host侧和UFS Device侧之间交互的所有UPIU,都携带该Local ID;而对于接收到的所有UPIU,UFS Host控制器都直接使用UPIU中携带的该Local ID可以索引到对应的上下文信息。比如,接收到DATA IN UPIU,根据DATA IN UPIU中的该Local ID 找到对应上下文信息,获取到加解密信息以及数据存储地址等;再如,接收到RESPONSE UPIU后,根据Local ID直接找到对应上下文信息,获取到RESPONSE写入DDR的存储地址。
因此,关于该读命令相关的所有UPIU,都携带该读命令对应的Local ID,UFS Host控制器可以直接使用该UPIU中携带的该读命令对应的Local ID索引到该读命令对应的上下文信息。
6、存储设备(存储控制器)创建本地命令上下文并执行命令。
具体地,UFS Device接收到来自UFS Host侧的COMMAND UPIU后,UFS Device从COMMAND UPIU中的指定位置提取出该读命令对应的Local ID,使用该读命令对应的Local ID作为其逻辑内部区分该读命令的唯一标识,用该读命令对应的Local ID来作为该读命令的上下文信息的维护地址,也即在COMMAND context中记录该读命令的上下文信息,并将该读命令对应的Local ID作为COMMAND context的索引地址,用于索引该读命令的上下文信息,从而建立了该读命令对应的Local ID与UFS Device中的该读命令的上下文信息的映射关系,COMMAND context与Local ID的索引关系如图11所示。
其中,具体上下文信息内容,由UFS Device控制器实现决定;具体的执行硬件为UFS Device控制器。
7、存储设备(存储控制器)向主机控制器发送数据输入UPIU。
具体地,UFS Device向UFS Host发送Data IN UPIU,并在该Data IN UPIU中的指定位置填入该读命令对应的Local ID。其中,具体的执行硬件为UFS Device控制器。
8、主机控制器查询上下文以获取数据写入地址并将数据写入数据缓冲区。
具体地,UFS Host控制器接收到来自UFS Device侧的DATA IN UPIU后,从该DATA IN UPIU中的指定位置提取出该读命令对应的Local ID,使用该读命令对应的Local ID直接索引到对应的上下文信息,进而根据索引到的上下文信息进行相应的数据处理(例如:解密操作,写入Host Memory等),再将数据写入数据缓存(data buffer)中。
进一步地,UFS Host控制器在接收到该DATA IN UPIU后,使用该DATA IN UPIU中的Local ID直接索引到上下文信息,再对索引到的上下文信息中的“LUN+Task Tag+IID”和DATA IN UPIU中的“LUN+Task Tag+IID”进行比对,进行容错检测;也即,验证DATA IN UPIU中的“LUN+Task Tag+IID”和Local ID的对应关系,与索引到的上下文信息中的“LUN+Task Tag+IID”和Local ID的对应关系是否一致。
9、存储设备(存储控制器)向主机控制器发送响应UPIU。
具体地,当该读命令对应的DATA IN UPIU全部返回给UFS Host后,UFS Device侧向UFS Host侧发送RESPONSE UPIU,并将该读命令的Local ID填入该RESPONSE UPIU中的指定位置。其中,具体的执行硬件为UFS Device控制器。
10、主机控制器查询上下文,获取响应写地址并写响应。
具体地,UFS Host控制器接收到来自UFS Device侧发来的该RESPONSE UPIU后,从该RESPONSE UPIU中的指定位置提取出该读命令对应的Local ID,使用该读命令对应的Local ID直接索引到对应的上下文信息,将RESPONSE写入Host Memory中的指定位置。
11、主机控制器清除门铃并回收本地ID。
具体地,UFS Host控制器将RESPONSE UPIU中携带的该读命令对应的Local ID写入到Local ID清单或队列中,进行回收利用;并清除该命令对应的Doorbell寄存器位,或者更新完成队列(Completion Queue,CQ)门铃尾标(CQ Doorbell tail pointer)。
需要说明的是,UFS Host与UFS Device之间执行写命令的场景和执行读命令的场景的区别在于:对于读命令,UFS Device侧接收到COMMAND UPIU后,向Host侧发送DATA IN UPIU,以向UFS Host侧发送读命令对应的数据;而对于写命令,UFS Device侧接收到COMMAND UPIU后,向UFS Host侧发送RTT UPIU,以指示Host侧开始向UFS Device侧发送写命令对应的数据,UFS Host侧接收到该RTT UPIU后,向UFS Device侧发送DATA OUT UPIU,以向UFS Device侧发送该写命令对应的数据。而UFS Host与UFS Device之间执行写命令的场景中其他步骤与执行读命令的场景中的相同,本申请不在赘述。
请参阅图12,图12是本申请实施例提供的一种数据处理方法的流程示意图,该数据处理方法应用于电子设备,该电子设备包括主机控制器和存储控制器;该方法包括但不限于以下步骤:
步骤1201、向存储控制器发送命令时,通过主机控制器建立命令中的第一上下文IO context信息与第一标识之间的映射关系,其中,第一IO context信息包括第二标识。
步骤1202、通过主机控制器向存储控制器发送第一数据包,其中,第一数据包包括第一标识和第二标识。
步骤1203、通过存储控制器接收第一数据包,并根据第一标识从第一数据包中获取与第二标识对应的第二IO context信息,以及建立第一标识与第二IO context信息之间的映射关系;其中,第一标识用于索引第一IO context信息或第二IO context信息。
在一种可能的实现方式中,命令为读命令;该方法还包括:通过存储控制器向主机控制器发送第二数据包,其中,第二数据包包括第一标识和读命令对应的数据;通过主机控制器接收第二数据包,并根据第一标识索引到第一IO context信息,以及根据第一IO context信息对读命令对应的数据进行处理。
在一种可能的实现方式中,第二数据包还包括第二标识;该方法还包括:通过主机控制器将第二数据包中的第二标识与第一IO context信息中的第二标识进行比对,以对第一IO context信息进行容错检测。
在一种可能的实现方式中,命令为写命令;该方法还包括:通过存储控制器向主机控制器发送第三数据包,其中,第三数据包包括第一标识,第三数据包用于指示主机控制器向存储控制器发送写命令对应的数据;通过主机控制器接收第三数据包,并根据第一标识索引到第一IO context信息,以及根据第一IO context信息向存储控制器发送第四数据包,其中,第四数据包包括第一标识和写命令对应的数据;通过存储控制器接收第四数据包,并根据第一标识索引到第二IO context信息,以及根据第二IO context信息对写命令对应的数据进行处理。
在一种可能的实现方式中,第三数据包还包括第二标识;该方法还包括:通过主机控制器将第三数据包中的第二标识与第一IO context信息中的第二标识进行比对,以对第一IO context信息进行容错检测。
在一种可能的实现方式中,第四数据包还包括第二标识;该方法还包括:通过存储控制器将第四数据包中的第二标识与第二IO context信息中的第二标识进行比对,以对第二IO context信息进行容错检测。
在一种可能的实现方式中,该方法还包括:通过主机控制器从存储于主机控制器中的预设标识清单中获取第一标识,并删除预设标识清单中的第一标识。
在一种可能的实现方式中,该方法还包括:通过存储控制器向主机控制器发送第五数据包,以及释放第一标识与第二IO context信息之间的映射关系,其中,第五数据包包括第一标识,第五数据包用于指示命令已执行完成;通过主机控制器接收第五数据包,并将第一标识写入预设标识清单中,以及释放第一IO context信息与第一标识之间的映射关系。
在一种可能的实现方式中,该方法还包括:当命令执行异常时,通过主机控制器将第一标识写入预设标识清单中,以及释放第一IO context信息与第一标识之间的映射关系;当命令执行异常时,通过存储控制器释放第一标识与第二IO context信息之间的映射关系。
在一种可能的实现方式中,通过主机控制器从存储于主机控制器中的预设标识清单中获取第一标识,并删除预设标识清单中的第一标识,包括:通过主机控制器判断主机控制器与存储控制器之间并发执行的命令的数量是否达到预设阈值;若未达到预设阈值,则通过主机控制器从预设标识清单中获取第一标识,并删除预设标识清单中的第一标识。
在一种可能的实现方式中,该方法还包括:通过主机控制器将第一标识写入第一数据包;通过主机控制器将第一标识作为第一命令上下文COMMAND context表的索引地址,其中,第一COMMAND context表为存储于主机控制器中的COMMAND context表。
在一种可能的实现方式中,该方法还包括:通过存储控制器根据第一标识从第二COMMAND context表中获取第二IO context信息,其中,第二COMMAND context表为存储于存储控制器中的COMMAND context表。
需要说明的是,本申请实施例中所描述的数据处理方法的具体流程,可参见上述图5-图11中所述的发明实施例中的相关描述,此处不再赘述。
在图12所描述的数据处理方法中,主机控制器在向存储控制器发送命令时,建立该命令中的第一上下文IO context信息与第一标识之间的映射关系,然后向存储控制器发送第一数据包;由于第一数据包中包含第一标识和第一IO context信息中的第二标识,存储控制器在接收到第一数据包后,根据第一标识从第一数据包中获取与第二标识对应的第二IO context信息,以及建立第一标识与第二IO context信息之间的映射关系;如此,第一标识与第一IO context信息和第二IO context信息均建立了映射关系,主机控制器可以通过该第一标识快速查找到第一IO context信息,存储控制器也可以通过该第一标识快速查找到第二IO context信息,从而可以减少延时开销,提升数据处理的效率。具体地,在主机控制器侧,由于第一标识与第一IO context信息建立了映射关系,主机控制器在接收到存储控制器发来的数据包后,可以通过第一标识直接去查找第一IO context信息,无需再通过第二标识去反向查找第一IO context信息,例如第二标识是“LUN+Task Tag+IID”,无需通过“LUN+Task Tag+IID”三个域段的组合来查找该第一IO context信息的索引地址,然后通过该索引地址来查找到该第一IO context信息,而直接将第一标识作为第一IO context信息的索引地址,通过第一标识直接查找到第一IO context信息,如此,主机控制器查找到第一 IO context信息的逻辑变简单,且主机控制器查找到第一IO context信息的耗时也减少;在存储控制器侧,由于第一标识与第二IO context信息建立了映射关系,存储控制器在接收到主机控制器发来的数据包后,可以通过第一标识直接去查找第二IO context信息,无需再通过第二标识去反向查找第二IO context信息,例如第二标识是“LUN+Task Tag+IID”,无需通过“LUN+Task Tag+IID”三个域段的组合来查找该第二IO context信息的索引地址,然后通过该索引地址来查找到该第二IO context信息,而直接将第一标识作为第二IO context信息的索引地址,通过第一标识直接查找到第二IO context信息,如此,存储控制器查找到第二IO context信息的逻辑变简单,且存储控制器查找到第二IO context信息的耗时也减少。综上,本申请实施例,可以减少延时开销,提升数据处理的效率。
请参阅图13,图13是本申请实施例提供的另一种数据处理方法的流程示意图,该数据处理方法应用于存储系统,该存储系统包括主机和存储设备,该主机包括主机控制器,该存储设备包括存储控制器;该方法包括但不限于以下步骤:
1301、向存储设备发送命令时,主机通过主机控制器建立命令中的第一上下文IO context信息与第一标识之间的映射关系;其中,第一标识用于索引第一IO context信息。
1302、主机通过主机控制器向存储设备发送第一数据包,其中,第一数据包包括第一标识和第二标识。
1303、存储设备通过存储控制器接收来自主机的第一数据包。
1304、存储设备通过存储控制器根据第一标识从第一数据包中获取与第二标识对应的第二上下文IO context信息,以及建立第一标识与第二IO context信息之间的映射关系;其中,第一标识用于索引第二IO context信息。
在一种可能的实现方式中,命令为读命令;该方法还包括:存储设备通过存储控制器向主机控制器发送第二数据包,其中,第二数据包包括第一标识和读命令对应的数据;主机通过主机控制器接收第二数据包,并根据第一标识索引到第一IO context信息,以及根据第一IO context信息对读命令对应的数据进行处理。
在一种可能的实现方式中,第二数据包还包括第二标识;该方法还包括:主机通过主机控制器将第二数据包中的第二标识与第一IO context信息中的第二标识进行比对,以对第一IO context信息进行容错检测。
在一种可能的实现方式中,命令为写命令;该方法还包括:存储设备通过存储控制器向主机控制器发送第三数据包,其中,第三数据包包括第一标识,第三数据包用于指示主机控制器向存储控制器发送写命令对应的数据;主机通过主机控制器接收第三数据包,并根据第一标识索引到第一IO context信息,以及根据第一IO context信息向存储控制器发送第四数据包,其中,第四数据包包括第一标识和写命令对应的数据;存储设备通过存储控制器接收第四数据包,并根据第一标识索引到第二IO context信息,以及根据第二IO context信息对写命令对应的数据进行处理。
在一种可能的实现方式中,第三数据包还包括第二标识;该方法还包括:主机通过主机控制器将第三数据包中的第二标识与第一IO context信息中的第二标识进行比对,以对第一IO context信息进行容错检测。
在一种可能的实现方式中,第四数据包还包括第二标识;该方法还包括:存储设备通过存储控制器将第四数据包中的第二标识与第二IO context信息中的第二标识进行比对,以对第二IO context信息进行容错检测。
在一种可能的实现方式中,该方法还包括:主机通过主机控制器从存储于主机控制器中的预设标识清单中获取第一标识,并删除预设标识清单中的第一标识。
在一种可能的实现方式中,该方法还包括:存储设备通过存储控制器向主机控制器发送第五数据包,以及释放第一标识与第二IO context信息之间的映射关系,其中,第五数据包包括第一标识,第五数据包用于指示命令已执行完成;主机通过主机控制器接收第五数据包,并将第一标识写入预设标识清单中,以及释放第一IO context信息与第一标识之间的映射关系。
在一种可能的实现方式中,该方法还包括:当命令执行异常时,主机通过主机控制器将第一标识写入预设标识清单中,以及释放第一IO context信息与第一标识之间的映射关系;当命令执行异常时,存储设备通过存储控制器释放第一标识与第二IO context信息之间的映射关系。
在一种可能的实现方式中,主机通过主机控制器从存储于主机控制器中的预设标识清单中获取第一标识,并删除预设标识清单中的第一标识,包括:主机通过主机控制器判断主机控制器与存储控制器之间并发执行的命令的数量是否达到预设阈值;若未达到预设阈值,主机则通过主机控制器从预设标识清单中获取第一标识,并删除预设标识清单中的第一标识。
在一种可能的实现方式中,该方法还包括:主机通过主机控制器将第一标识写入第一数据包;主机通过主机控制器将第一标识作为第一命令上下文COMMAND context表的索引地址,其中,第一COMMAND context表为存储于主机控制器中的COMMAND context表。
在一种可能的实现方式中,该方法还包括:存储设备通过存储控制器根据第一标识从第二COMMAND context表中获取第二IO context信息,其中,第二COMMAND context表为存储于存储控制器中的COMMAND context表。
需要说明的是,本申请实施例中所描述的数据处理方法的具体流程,可参见上述图5-图11中所述的发明实施例中的相关描述,此处不再赘述。
在图13所描述的数据处理方法中,主机控制器在向存储控制器发送命令时,建立该命令中的第一上下文IO context信息与第一标识之间的映射关系,然后向存储控制器发送第一数据包;由于第一数据包中包含第一标识和第一IO context信息中的第二标识,存储控制器在接收到第一数据包后,根据第一标识从第一数据包中获取与第二标识对应的第二IO context信息,以及建立第一标识与第二IO context信息之间的映射关系;如此,第一标识与第一IO context信息和第二IO context信息均建立了映射关系,主机控制器可以通过该第一标识快速查找到第一IO context信息,存储控制器也可以通过该第一标识快速查找到第二IO context信息,从而可以减少延时开销,提升数据处理的效率。具体地,在主机控制器侧,由于第一标识与第一IO context信息建立了映射关系,主机控制器在接收到存储控制器发来的数据包后,可以通过第一标识直接去查找第一IO context信息,无需再通过第 二标识去反向查找第一IO context信息,例如第二标识是“LUN+Task Tag+IID”,无需通过“LUN+Task Tag+IID”三个域段的组合来查找该第一IO context信息的索引地址,然后通过该索引地址来查找到该第一IO context信息,而直接将第一标识作为第一IO context信息的索引地址,通过第一标识直接查找到第一IO context信息,如此,主机控制器查找到第一IO context信息的逻辑变简单,且主机控制器查找到第一IO context信息的耗时也减少;在存储控制器侧,由于第一标识与第二IO context信息建立了映射关系,存储控制器在接收到主机控制器发来的数据包后,可以通过第一标识直接去查找第二IO context信息,无需再通过第二标识去反向查找第二IO context信息,例如第二标识是“LUN+Task Tag+IID”,无需通过“LUN+Task Tag+IID”三个域段的组合来查找该第二IO context信息的索引地址,然后通过该索引地址来查找到该第二IO context信息,而直接将第一标识作为第二IO context信息的索引地址,通过第一标识直接查找到第二IO context信息,如此,存储控制器查找到第二IO context信息的逻辑变简单,且存储控制器查找到第二IO context信息的耗时也减少。综上,本申请实施例,可以减少延时开销,提升数据处理的效率。
本申请实施例还提供一种电子设备,包括:主机以及耦合于主机的存储设备;主机为上述实施例中的任意一种主机;存储设备为上述实施例中的任意一种存储设备。
本申请实施例还提供一种电子设备,包括处理器、存储器、通信接口,以及一个或多个程序,上述一个或多个程序被存储在上述存储器中,并且被配置由上述处理器执行,上述程序包括用于执行如上述方法实施例中记载的任意一种数据处理方法中的步骤的指令。
本申请实施例还提供一种芯片,该芯片包括:处理器,用于从存储器中调用并运行计算机程序,使得安装有所述芯片的设备执行上述方法实施例中记载的任意一种数据处理方法的部分或全部步骤。
本申请实施例还提供一种计算机可读存储介质,其中,该计算机可读存储介质可存储有程序,该程序被电子设备、主机或存储设备执行时,实现包括上述方法实施例中记载的任意一种数据处理方法的部分或全部步骤。
本申请实施例还提供一种计算机程序,该计算机程序包括指令,当该计算机程序被电子设备、主机或存储设备执行时,使得电子设备、主机或存储设备可以执行上述方法实施例中记载的任意一种数据处理方法的部分或全部步骤。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其它实施例的相关描述。
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可能可以采用其它顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如上述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可 以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性或其它的形式。
上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本申请各实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
上述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以为个人计算机、服务器或者网络设备等,具体可以是计算机设备中的处理器)执行本申请各个实施例上述方法的全部或部分步骤。其中,而前述的存储介质可包括:U盘、移动硬盘、磁碟、光盘、只读存储器(Read-Only Memory,缩写:ROM)或者随机存取存储器(Random Access Memory,缩写:RAM)等各种可以存储程序代码的介质。
以上所述,以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围。

Claims (40)

  1. 一种数据处理装置,其特征在于,包括:主机控制器和存储控制器;
    所述主机控制器,用于向存储控制器发送命令时,建立所述命令中的第一上下文IO context信息与第一标识之间的映射关系,其中,所述第一IO context信息包括第二标识;
    所述主机控制器,还用于向所述存储控制器发送第一数据包,其中,所述第一数据包包括所述第一标识和所述第二标识;
    所述存储控制器,用于接收所述第一数据包,并根据所述第一标识从所述第一数据包中获取与所述第二标识对应的第二IO context信息,以及建立所述第一标识与所述第二IO context信息之间的映射关系;
    其中,所述第一标识用于索引所述第一IO context信息或所述第二IO context信息。
  2. 根据权利要求1所述的装置,其特征在于,所述命令为读命令;
    所述存储控制器,还用于向所述主机控制器发送第二数据包,其中,所述第二数据包包括所述第一标识和所述读命令对应的数据;
    所述主机控制器,还用于接收所述第二数据包,并根据所述第一标识索引到所述第一IO context信息,以及根据所述第一IO context信息对所述读命令对应的数据进行处理。
  3. 根据权利要求2所述的装置,其特征在于,所述第二数据包还包括所述第二标识;所述主机控制器,还用于:
    将所述第二数据包中的所述第二标识与所述第一IO context信息中的所述第二标识进行比对,以对所述第一IO context信息进行容错检测。
  4. 根据权利要求1所述的装置,其特征在于,所述命令为写命令;
    所述存储控制器,还用于向所述主机控制器发送第三数据包,其中,所述第三数据包包括所述第一标识,所述第三数据包用于指示所述主机控制器向所述存储控制器发送所述写命令对应的数据;
    所述主机控制器,还用于接收所述第三数据包,并根据所述第一标识索引到所述第一IO context信息,以及根据所述第一IO context信息向所述存储控制器发送第四数据包,其中,所述第四数据包包括所述第一标识和所述写命令对应的数据;
    所述存储控制器,还用于接收所述第四数据包,并根据所述第一标识索引到所述第二IO context信息,以及根据所述第二IO context信息对所述写命令对应的数据进行处理。
  5. 根据权利要求1-4中任一项所述的装置,其特征在于,
    所述主机控制器,还用于从存储于所述主机控制器中的预设标识清单中获取所述第一标识,并删除所述预设标识清单中的所述第一标识。
  6. 根据权利要求5所述的装置,其特征在于,
    所述存储控制器,还用于向所述主机控制器发送第五数据包,以及释放所述第一标识与所述第二IO context信息之间的映射关系,其中,所述第五数据包包括所述第一标识,所述第五数据包用于指示所述命令已执行完成;
    所述主机控制器,还用于接收所述第五数据包,并将所述第一标识写入所述预设标识清单中,以及释放所述第一IO context信息与所述第一标识之间的映射关系。
  7. 根据权利要求5所述的装置,其特征在于,
    所述主机控制器,还用于当所述命令执行异常时,将所述第一标识写入所述预设标识清单中,以及释放所述第一IO context信息与所述第一标识之间的映射关系;
    所述存储控制器,还用于当所述命令执行异常时,释放所述第一标识与所述第二IO context信息之间的映射关系。
  8. 根据权利要求5-7中任一项所述的装置,其特征在于,所述主机控制器,具体用于:
    判断所述主机控制器与所述存储控制器之间并发执行的命令的数量是否达到预设阈值;
    若未达到预设阈值,则从所述预设标识清单中获取所述第一标识,并删除所述预设标识清单中的所述第一标识。
  9. 根据权利要求1-8中任一项所述的装置,其特征在于,所述主机控制器,还用于:
    将所述第一标识写入所述第一数据包;
    将所述第一标识作为第一命令上下文COMMAND context表的索引地址,其中,所述第一COMMAND context表为存储于所述主机控制器中的COMMAND context表。
  10. 根据权利要求1-9中任一项所述的装置,其特征在于,所述存储控制器,还用于:
    根据所述第一标识从第二COMMAND context表中获取所述第二IO context信息,其中,所述第二COMMAND context表为存储于所述存储控制器中的COMMAND context表。
  11. 一种主机,其特征在于,包括主机控制器;所述主机控制器,用于:
    向存储设备发送命令时,建立所述命令中的第一上下文IO context信息与第一标识之间的映射关系;
    其中,所述第一标识用于索引所述第一IO context信息。
  12. 根据权利要求11所述的主机,其特征在于,所述主机控制器,还用于:
    向所述存储设备发送第一数据包,其中,所述第一数据包包括所述第一标识。
  13. 根据权利要求12的主机,其特征在于,所述命令为读命令;所述主机控制器,还用于:
    接收来自所述存储设备的第二数据包,其中,所述第二数据包包括所述第一标识和所述读命令对应的数据;
    根据所述第一标识索引到所述第一IO context信息,以及根据所述第一IO context信息对所述读命令对应的数据进行处理。
  14. 根据权利要求13所述的主机,其特征在于,所述第二数据包还包括第二标识,所述第一IO context信息包括第二标识;所述主机控制器,还用于:
    将所述第二数据包中的所述第二标识与所述第一IO context信息中的所述第二标识进行比对,以对所述第一IO context信息进行容错检测。
  15. 根据权利要求12所述的主机,其特征在于,所述命令为写命令;所述主机控制器,还用于:
    接收来自所述存储设备的第三数据包,其中,所述第三数据包包括所述第一标识,所述第三数据包用于指示所述主机向所述存储设备发送所述写命令对应的数据;
    根据所述第一标识索引到所述第一IO context信息,以及根据所述第一IO context信息向所述存储设备发送第四数据包,其中,所述第四数据包包括所述第一标识和所述写命令对应的数据。
  16. 根据权利要求11-15中任一项所述的主机,其特征在于,所述主机控制器,还用于:
    从存储于所述主机控制器中的预设标识清单中获取所述第一标识,并删除所述预设标识清单中的所述第一标识。
  17. 根据权利要求16所述的主机,其特征在于,所述主机控制器,还用于:
    接收来自所述存储设备的第五数据包,其中,所述第五数据包包括所述第一标识,所述第五数据包用于指示所述命令已执行完成;
    将所述第一标识写入所述预设标识清单中,以及释放所述第一IO context信息与所述第一标识之间的映射关系。
  18. 根据权利要求16所述的主机,其特征在于,所述主机控制器,还用于:
    当所述命令执行异常时,将所述第一标识写入所述预设标识清单中,以及释放所述第一IO context信息与所述第一标识之间的映射关系。
  19. 根据权利要求16-18中任一项所述的主机,其特征在于,所述主机控制器,具体用于:
    判断所述主机与所述存储设备之间并发执行的命令的数量是否达到预设阈值;
    若未达到预设阈值,则从所述预设标识清单中获取所述第一标识,并删除所述预设标识清单中的所述第一标识。
  20. 根据权利要求11-19中任一项所述的主机,其特征在于,所述主机控制器,还用于:
    将所述第一标识写入所述第一数据包;
    将所述第一标识作为第一命令上下文COMMAND context表的索引地址,其中,所述第一COMMAND context表为存储于所述主机控制器中的COMMAND context表。
  21. 一种存储设备,其特征在于,包括存储控制器;所述存储控制器,用于:
    接收来自主机的第一数据包,其中,所述第一数据包包括第一标识和第二标识;
    根据所述第一标识从所述第一数据包中获取与所述第二标识对应的第二上下文IO context信息,以及建立所述第一标识与所述第二IO context信息之间的映射关系;
    其中,所述第一标识用于索引所述第二IO context信息。
  22. 根据权利要求21所述的存储设备,其特征在于,所述第一数据包为读命令对应的数据包;所述存储控制器,还用于:
    向所述主机发送第二数据包,其中,所述第二数据包包括所述第一标识和所述读命令对应的数据。
  23. 根据权利要求21所述的存储设备,其特征在于,所述第一数据包为写命令对应的数据包;所述存储控制器,还用于:
    向所述主机发送第三数据包,其中,所述第三数据包包括所述第一标识,所述第三数据包用于指示所述主机向所述存储设备发送所述写命令对应的数据;
    接收来自所述主机的第四数据包,其中,所述第四数据包包括所述第一标识和所述写命令对应的数据;
    根据所述第一标识索引到所述第二IO context信息,以及根据所述第二IO context信息对所述写命令对应的数据进行处理。
  24. 根据权利要求21-23中任一项所述的存储设备,其特征在于,所述存储控制器,还用于:
    向所述主机发送第五数据包,以及释放所述第一标识与所述第二IO context信息之间的映射关系,其中,所述第五数据包包括所述第一标识,所述第五数据包用于指示所述命令已执行完成。
  25. 根据权利要求21-23中任一项所述的存储设备,其特征在于,所述存储控制器,还用于:
    当所述命令执行异常时,释放所述第一标识与所述第二IO context信息之间的映射关系。
  26. 根据权利要求21-25中任一项所述的存储设备,其特征在于,所述存储控制器,还用于:
    根据所述第一标识从第二命令上下文COMMAND context表中获取所述第二IO  context信息,其中,所述第二COMMAND context表为存储于所述存储控制器中的COMMAND context表。
  27. 一种电子设备,其特征在于,包括:主机以及耦合于所述主机的存储设备;
    所述主机为如权利要求11-20任意一项所述的主机;
    所述存储设备为如权利要求21-26任意一项所述的存储设备。
  28. 一种数据处理方法,其特征在于,应用于电子设备,所述电子设备包括主机控制器和存储控制器;所述方法包括:
    向存储控制器发送命令时,通过所述主机控制器建立所述命令中的第一上下文IO context信息与第一标识之间的映射关系,其中,所述第一IO context信息包括第二标识;
    通过所述主机控制器向所述存储控制器发送第一数据包,其中,所述第一数据包包括所述第一标识和所述第二标识;
    通过所述存储控制器接收所述第一数据包,并根据所述第一标识从所述第一数据包中获取与所述第二标识对应的第二IO context信息,以及建立所述第一标识与所述第二IO context信息之间的映射关系;
    其中,所述第一标识用于索引所述第一IO context信息或所述第二IO context信息。
  29. 根据权利要求28所述的方法,其特征在于,所述命令为读命令;所述方法还包括:
    通过所述存储控制器向所述主机控制器发送第二数据包,其中,所述第二数据包包括所述第一标识和所述读命令对应的数据;
    通过所述主机控制器接收所述第二数据包,并根据所述第一标识索引到所述第一IO context信息,以及根据所述第一IO context信息对所述读命令对应的数据进行处理。
  30. 根据权利要求29所述的方法,其特征在于,所述第二数据包还包括所述第二标识;所述方法还包括:
    通过所述主机控制器将所述第二数据包中的所述第二标识与所述第一IO context信息中的所述第二标识进行比对,以对所述第一IO context信息进行容错检测。
  31. 根据权利要求28所述的方法,其特征在于,所述命令为写命令;所述方法还包括:
    通过所述存储控制器向所述主机控制器发送第三数据包,其中,所述第三数据包包括所述第一标识,所述第三数据包用于指示所述主机控制器向所述存储控制器发送所述写命令对应的数据;
    通过所述主机控制器接收所述第三数据包,并根据所述第一标识索引到所述第一IO context信息,以及根据所述第一IO context信息向所述存储控制器发送第四数据包,其中,所述第四数据包包括所述第一标识和所述写命令对应的数据;
    通过所述存储控制器接收所述第四数据包,并根据所述第一标识索引到所述第二IO context信息,以及根据所述第二IO context信息对所述写命令对应的数据进行处理。
  32. 根据权利要求28-31中任一项所述的方法,其特征在于,所述方法还包括:
    通过所述主机控制器从存储于所述主机控制器中的预设标识清单中获取所述第一标识,并删除所述预设标识清单中的所述第一标识。
  33. 根据权利要求32所述的方法,其特征在于,所述方法还包括:
    通过所述存储控制器向所述主机控制器发送第五数据包,以及释放所述第一标识与所述第二IO context信息之间的映射关系,其中,所述第五数据包包括所述第一标识,所述第五数据包用于指示所述命令已执行完成;
    通过所述主机控制器接收所述第五数据包,并将所述第一标识写入所述预设标识清单中,以及释放所述第一IO context信息与所述第一标识之间的映射关系。
  34. 根据权利要求32所述的方法,其特征在于,所述方法还包括:
    当所述命令执行异常时,通过所述主机控制器将所述第一标识写入所述预设标识清单中,以及释放所述第一IO context信息与所述第一标识之间的映射关系;
    以及通过所述存储控制器释放所述第一标识与所述第二IO context信息之间的映射关系。
  35. 根据权利要求32-34所述的方法,其特征在于,所述通过所述主机控制器从存储于所述主机控制器中的预设标识清单中获取所述第一标识,并删除所述预设标识清单中的所述第一标识,包括:
    通过所述主机控制器判断所述主机控制器与所述存储控制器之间并发执行的命令的数量是否达到预设阈值;
    若未达到预设阈值,则通过所述主机控制器从所述预设标识清单中获取所述第一标识,并删除所述预设标识清单中的所述第一标识。
  36. 根据权利要求28-35中任一项所述的方法,其特征在于,所述方法还包括:
    通过所述主机控制器将所述第一标识写入所述第一数据包;
    通过所述主机控制器将所述第一标识作为第一命令上下文COMMAND context表的索引地址,其中,所述第一COMMAND context表为存储于所述主机控制器中的COMMAND context表。
  37. 根据权利要求28-36中任一项所述的方法,其特征在于,所述方法还包括:
    通过存储控制器根据所述第一标识从第二COMMAND context表中获取所述第二IO context信息,其中,所述第二COMMAND context表为存储于所述存储控制器中的COMMAND context表。
  38. 一种芯片,其特征在于,包括:处理器,用于从存储器中调用并运行计算机程序, 使得安装有所述芯片的设备执行如权利要求28-37中任一项所述的方法。
  39. 一种计算机可读存储介质,其特征在于,其存储用于电子数据交换的计算机程序,所述计算机程序使得计算机执行如权利要求28-37中任一项所述的方法。
  40. 一种计算机程序产品,所述计算机程序产品使得计算机执行如权利要求28-37中任一项所述的方法。
PCT/CN2020/137321 2020-12-17 2020-12-17 数据处理方法及相关设备 WO2022126534A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2020/137321 WO2022126534A1 (zh) 2020-12-17 2020-12-17 数据处理方法及相关设备
CN202080107940.4A CN116964565A (zh) 2020-12-17 2020-12-17 数据处理方法及相关设备

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/137321 WO2022126534A1 (zh) 2020-12-17 2020-12-17 数据处理方法及相关设备

Publications (1)

Publication Number Publication Date
WO2022126534A1 true WO2022126534A1 (zh) 2022-06-23

Family

ID=82058838

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/137321 WO2022126534A1 (zh) 2020-12-17 2020-12-17 数据处理方法及相关设备

Country Status (2)

Country Link
CN (1) CN116964565A (zh)
WO (1) WO2022126534A1 (zh)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100312973A1 (en) * 2009-06-03 2010-12-09 Micron Technology, Inc. Methods for controlling host memory access with memory devices and systems
CN107015920A (zh) * 2015-12-30 2017-08-04 三星电子株式会社 存储设备和存储设备的操作方法
CN108197039A (zh) * 2017-12-28 2018-06-22 湖南国科微电子股份有限公司 一种ssd控制器混合流数据的传输方法和系统
CN108880972A (zh) * 2017-05-09 2018-11-23 腾讯科技(深圳)有限公司 一种信息处理方法、服务器及终端
CN109246660A (zh) * 2017-06-30 2019-01-18 华为技术有限公司 一种管理本体的方法以及m2m平台
CN111427808A (zh) * 2019-01-10 2020-07-17 三星电子株式会社 用于管理存储设备和主机单元之间的通信的系统和方法
CN111831215A (zh) * 2019-04-22 2020-10-27 爱思开海力士有限公司 用于在存储器系统中传输映射信息的装置

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100312973A1 (en) * 2009-06-03 2010-12-09 Micron Technology, Inc. Methods for controlling host memory access with memory devices and systems
CN107015920A (zh) * 2015-12-30 2017-08-04 三星电子株式会社 存储设备和存储设备的操作方法
CN108880972A (zh) * 2017-05-09 2018-11-23 腾讯科技(深圳)有限公司 一种信息处理方法、服务器及终端
CN109246660A (zh) * 2017-06-30 2019-01-18 华为技术有限公司 一种管理本体的方法以及m2m平台
CN108197039A (zh) * 2017-12-28 2018-06-22 湖南国科微电子股份有限公司 一种ssd控制器混合流数据的传输方法和系统
CN111427808A (zh) * 2019-01-10 2020-07-17 三星电子株式会社 用于管理存储设备和主机单元之间的通信的系统和方法
CN111831215A (zh) * 2019-04-22 2020-10-27 爱思开海力士有限公司 用于在存储器系统中传输映射信息的装置

Also Published As

Publication number Publication date
CN116964565A (zh) 2023-10-27

Similar Documents

Publication Publication Date Title
US10437481B2 (en) Data access method and related apparatus and system
US9727503B2 (en) Storage system and server
US9092426B1 (en) Zero-copy direct memory access (DMA) network-attached storage (NAS) file system block writing
US20150261720A1 (en) Accessing remote storage devices using a local bus protocol
TWI443513B (zh) 記憶體儲存裝置、記憶體控制器與資料寫入方法
US20180260145A1 (en) Internal system namespace exposed through control memory buffer
WO2023103296A1 (zh) 一种写数据高速缓存的方法、系统、设备和存储介质
US8041849B2 (en) Method for handling small computer system interface (SCSI) commands via a redundant array of inexpensive disks (RAID) device driver
CN109871182A (zh) 存储装置及其操作方法及发出命令的方法
WO2015180598A1 (zh) 对存储设备的访问信息处理方法和装置、系统
WO2019090493A1 (zh) 内存块回收方法和装置
CN109086168A (zh) 一种利用硬件备份固态硬盘写速度的方法及其系统
US20220253252A1 (en) Data processing method and apparatus
WO2023124422A1 (zh) 一种数据读写的控制方法及电子设备
WO2020087931A1 (zh) 一种数据备份方法、装置及系统
US20240086113A1 (en) Synchronous write method and device, storage system and electronic device
WO2022151707A1 (zh) 内存测试方法及装置、可读存储介质、电子设备
US10853255B2 (en) Apparatus and method of optimizing memory transactions to persistent memory using an architectural data mover
WO2022126534A1 (zh) 数据处理方法及相关设备
US20220253238A1 (en) Method and apparatus for accessing solid state disk
CN115586943A (zh) 一种智能网卡虚拟机脏页的硬件标记实现方法
US20060277326A1 (en) Data transfer system and method
WO2023056687A1 (zh) 一种固态硬盘及其数据操作方法、装置及电子设备
WO2021159608A1 (zh) 一种基于Protocol Buffer的镜像缓存方法
CN116601616A (zh) 一种数据处理装置、方法及相关设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20965550

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 202080107940.4

Country of ref document: CN

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20965550

Country of ref document: EP

Kind code of ref document: A1