Transmission optimization method for virtual storage controller, and electronic device
By introducing a breakpoint continuous transmission mechanism in the virtio_blk controller, the transmission of storage packets is optimized, and the efficiency problem of the virtio-blk controller when transmitting storage data to remote disks is solved, achieving more efficient storage data transmission and better system stability.
Patent Information
- Application Number
- PCT/CN2024/136049
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-12-13
- Filing Date
- 2024-12-02
- Publication Date
- 2025-06-19
AI Technical Summary
In the prior art, when virtio-blk controller transmits storage data to remote disks, it is necessary to mount multiple remote disks in the host system, resulting in a reduced network transmission efficiency.
A transmission optimization method for virtual storage controllers is designed. By introducing a breakpoint continuous transmission mechanism in the virtio_blk controller, the transmission of storage packets can be optimized, ensuring that when the soc side exception or the remote disk read and write exception is abnormal, the storage packet loss can be effectively handled and the discarded IO transmission can be re-initiated.
It improves the transmission efficiency of storage data, reduces the overhead of CPU cores, solves the problem of storage packet loss after abnormal restart on the Soc side, and has good scalability and maintainability.
Smart Images

Figure CN2024136049_19062025_PF_FP_ABST
Abstract
Description
A transmission optimization method for a virtual storage controller and an electronic device
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] This application claims priority to the Chinese patent application filed with the China Patent Office on December 13, 2023, with application number 202311712774.2 and invention name “A transmission optimization method for a virtual storage controller”, the entire contents of which are incorporated by reference into this application. Technical Field
[0003] The present application relates to the field of data communication technology, and more specifically, to a transmission optimization method of a virtual storage controller and an electronic device. Background Art
[0004] The virtual storage controller is an important component in a computer system. It is mainly responsible for managing the virtual storage system and implementing the virtual memory function. Currently, the most widely used controller is the virtio-blk controller.
[0005] The virtio-blk controller is an implementation of virtual disks on the KVM virtualization platform. Within the KVM platform, the qemu program is responsible for simulating the entire operating process of a PC. Qemu's device emulation can be divided into full emulation and semi-emulation. Full emulation does not require device drivers specifically for virtualization scenarios and can reuse drivers from the physical environment. However, in full emulation, the virtual machine's internal driver frequently accesses the virtual machine's I / O ports, resulting in a large number of trap-in and trap-out operations on the KVM platform. Furthermore, data transfer within and outside the virtual machine is copied only in bytes, preventing direct shared memory access, significantly reducing access performance. Semi-emulation, on the other hand, combines virtualized devices with front-end drivers, employing a novel event notification and data transfer mechanism, significantly improving performance. For example, when implementing disk access using the virtio-blk controller, io_event_fd is used for front-end-to-backend notifications, interrupt injection is used for back-end-to-frontend notifications, and data is shared through the I / O ring (Vring).
[0006] In existing technologies, hardware acceleration of Virtio is a common practice in the industry. Therefore, implementing virtio_blk hardware acceleration in smart network cards is an inevitable trend. However, mapping the virtio-blk controller to the backend to remote disks requires mounting many remote disks on the host system, reducing network transmission efficiency. Summary of the Invention
[0007] In order to overcome the above-mentioned defects of the prior art, embodiments of the present application provide a transmission optimization method of a virtual storage controller and an electronic device to solve the problems raised in the above-mentioned background technology.
[0008] To achieve the above objectives, the present application provides the following technical solutions: a transmission optimization method for a virtual storage controller, applied to a virtio_blk controller, wherein the virtio_blk controller includes a virtio_csr, a virtio_adaptor, a fetch_index, a fetch_ring, a fetch_desc, a fetch_pkt, a mate_builder, a slot_adaptor, a data_parser, and an updata_pkt;
[0009] When the storage packet on the link between the virtio_blk controller and the soc side is lost, the virtio_blk controller handles it;
[0010] When an abnormality on the soc side causes the forwarding storage packet to be lost, the virtio_blk controller handles it;
[0011] When the remote disk reads and writes abnormally and no completion packet is returned, resulting in storage packet loss, the SOC side handles it.
[0012] Optionally, the virtio_csr is a register module of virtio, used to cache the common configuration registers and specific configuration registers of the queue corresponding to the PF or VF; virtio_csr is used as a register interaction between the client host side driver and the FPGA side device, and is used for the control channel of the entire virtio;
[0013] The virtio_adaptor is a data channel merging and selection module that selects channels for multiple DMA read and write requests. When the virtio_blk controller initiates a DMA read and write request to the client host, it merges multiple request channels into one channel using RR polling to interact with the client host. When the client host responds to the read request of the virtio_blk controller, it splits the returned response data and returns it correctly to the corresponding channel according to the previously recorded read request order.
[0014] Optionally, the fetch_index: obtains the notify notification mechanism on the client and host sides to obtain the headindex in the shared ring of the virtual queue on the client and host sides; when a notify signal from the corresponding queue is received, the fetch_index obtains the index of the corresponding queue on the client and host sides, and transmits the obtained headindex to the fetch_ring;
[0015] The fetch_ring obtains the corresponding array value in the shared ring of the virtual queue on the client host side. The index of the array value is headindex, and the content is the index of the first descriptor linked list corresponding to index; when fetch_index inputs index related information, fetch_ring obtains the array value from the client host, that is, the position index of the first descriptor, and passes it to fetch_desc.
[0016] Optionally, the fetch_desc: obtains the descriptor corresponding to the current headindex in the virtual queue on the client host side, driven by the array information transmitted by fetch_ring, the array contains the first number of the first descriptor in the descriptor linked list, finds the first descriptor corresponding to the index according to the first number, the first descriptor includes the second number of the second descriptor, and the second descriptor of the linked list is found by the second number. The second descriptor also includes the third number of the third descriptor position, and so on. All descriptor linked lists corresponding to the index are found according to the third number, and the linked lists composed of complete descriptors corresponding to the same index of the same virtual queue are arranged in the order of front and back acquisition, and are transmitted to mate_builder for processing in one go;
[0017] The mate_builder is a group header, and the descriptor linked list corresponding to the same index of the same queue is classified and transmitted. The mate_builder is driven by the descriptor linked list information transmitted by fetch_desc; when the completed descriptor linked list is received, it will be divided into two parts according to the flag bit in the descriptor; the first part is the descriptor of the write-only client host, and the descriptors in the first part form a packet header and are transmitted to fetch_pkt; the second part is the descriptor of the read-only client host, which is also transmitted to fetch_pkt, and the descriptor of the read-only client host needs to be consumed by fetch_pkt.
[0018] Optionally, the fetch_pkt: obtains the read-only data on the client host side and assembles it into a package. fetch_pkt is driven by the two parts of descriptor information transmitted by mate_builder. fetch_pkt disassembles and analyzes the descriptor of the read-only client host, obtains the description data on the client host side according to the address + data length in the descriptor, and splices and merges the description data and the packet header composed of the write-only client host descriptor to form a storage packet of packet header + data, which is transmitted to slot_adaptor;
[0019] The slot_adaptor is the input and output module of the virtio_blk controller connecting to the remote disk. The slot_adaptor includes two functions. The first function is to add a first mark to the first storage packet input by fetch_pkt to indicate that a storage packet is a storage packet of the corresponding PF or VF virtual queue, so that the output storage packet is a complete packet; the second function is to receive the completion packet returned by the remote disk, parse the corresponding PF or VF queue information, and transmit the parsed result and the corresponding completion packet information to the data_parser module for processing.
[0020] Optionally, the data_parser: parses the completion packet from the slot_adaptor. The data_parser is driven by the completion packet and other information transmitted by the slot_adaptor. When the completion packet is received, the first step is to strip the header and data part. The second step is to parse out the write-only client host descriptor and other information carried in the header to obtain parsing information. The third step is to transmit the parsing information and the remaining data part after stripping to updata_pkt.
[0021] The updata_pkt is used to monitor uploaded data, update the used_index on the client host side, and initiate interrupt information; updata_pkt is driven by information such as the parsing package transmitted by data_parser. When updata_pkt receives the parsing information and data, it writes the data in segments to the client host side memory according to the write-only client host descriptor in the parsing information. After writing the data, it updates the used_index of the shared ring on the client host side, and initiates an interrupt command to the client host to notify the client host that there is new data update.
[0022] Optionally, when a storage packet on the link between the virtio_blk controller and the SOC is lost, the virtio_blk controller handles the following:
[0023] When the SOC is busy and unable to receive storage packets from the virtio_blk controller, the FPGA internally applies hierarchical backpressure to the storage packets and sends them to the client host. If the SOC accidentally resets the transmission channel corresponding to virtio_net_blk, rendering the transmission channel invalid, the storage packets transmitted from the virtio_blk controller will be lost. The SOC will then resume transmission of the storage packets after receiving virtio_net_blk again. To this end, the FPGA internally performs breakpoint processing. Specifically, before restarting virtio_net_blk, the SOC proactively sends a breakpoint message to the virtio_blk controller. The virtio_blk controller determines that a storage packet has been lost, then uses used_index to determine the breakpoint location and decides to re-initiate the transmission of the discarded IO. At the same time, the SOC must re-check the breakpoint location.
[0024] Optionally, when an abnormality on the SOC side causes the forwarding storage packet to be lost, the virtio_blk controller handles the following:
[0025] The soc side forwards the storage packet using the TCP protocol and re-establishes the link for transmission. When an abnormality on the soc side causes the forwarded storage packet to be lost, the soc side initiates a retransmission instruction.
[0026] Optionally, when a remote disk read / write exception occurs and no completion packet is returned, resulting in storage packet loss, the SOC side processing process includes:
[0027] A timeout mechanism is set on the soc side. If the remote disk does not respond to whether the read or write operation is completed within the preset time, the soc side can actively build a completion packet and return it to the virtio_blk controller, and mark the status value at the end of the corresponding packet as abnormal information. After the host receives the corresponding abnormal information, it handles it on its own to ensure that the entire transmission is not stuck. If the preset time is exceeded, the remote disk returns the completion information. At the same time, the soc side deletes the abnormal information to avoid repeated and unnecessary errors.
[0028] In a second aspect, the present application provides an electronic device, comprising: a processor and a memory, wherein the memory stores a computer program that can be called by the processor;
[0029] The processor executes the above-mentioned transmission optimization method of a virtual storage controller by calling the computer program stored in the memory.
[0030] In a third aspect, the present application provides a computer-readable storage medium storing instructions, which, when executed on a computer, enable the computer to execute the above-mentioned transmission optimization method for a virtual storage controller.
[0031] The technical effects and advantages of this application are:
[0032] 1. This application, based on the virtio_blk controller design of the Smart NIC, optimizes the overall system design architecture. Compared with pure software implementation, it improves the transmission efficiency of stored data and saves CPU core overhead, achieving multiple goals at one stroke.
[0033] 2. This application is based on the breakpoint resume mechanism of the virtio_blk controller, cleverly solving the problem of storage data packet loss when the SoC side restarts abnormally;
[0034] 3. This application has good scalability and is compatible with the development of other functions, such as storage hot migration. The implemented architecture is clear and has good maintainability. It has been successfully developed and has been tested in practice, and should be protected even more. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] Figure 1 is a schematic diagram of the structure of a storage and data transmission module implemented in a smart network card;
[0036] FIG2 is a schematic diagram of the front-end and back-end structures of virtio_blk in Example 1;
[0037] FIG3 is a schematic diagram of the structure of the virtio_blk controller inside the FPGA in Example 1;
[0038] FIG4 is a schematic diagram of the storage request packet format output by the virtio_blk controller in Example 2;
[0039] FIG5 is a schematic diagram of the format of a storage completion packet received by the virtio_blk controller from the remote end in Example 2;
[0040] FIG6 is a schematic diagram of an electronic device according to Example 3;
[0041] FIG7 is a schematic diagram of a computer-readable storage medium according to Example 4. DETAILED DESCRIPTION
[0042] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0043] In addition, the accompanying drawings are merely schematic illustrations of the present application and are not necessarily drawn to scale. Identical reference numerals in the figures denote identical or similar parts, and thus repetitive descriptions thereof will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities that do not necessarily correspond to physically or logically independent entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor approaches and / or microcontroller approaches.
[0044] It should be understood that although the terms "first," "second," and the like may be used herein to describe various elements, these elements should not be limited by these terms. These terms are used solely to distinguish one element from another. For example, a first element may be referred to as a second element, and a similar second element may be referred to as a first element, without departing from the scope of the exemplary embodiments. The term "and / or" as used herein includes any and all combinations of one or more of the listed associated items.
[0045] Please refer to Figure 1, which shows the architecture of the DPU SmartNIC where the virtio_blk controller is located:
[0046] In the smart network card, the virtio_blk controller is connected to the client host through a PCIE controller. Read or write operation instructions initiated by the client host are forwarded by the virtio_blk controller, transparently transmitted through the FPGA, and transmitted to the SOC side outside the FPGA through the virtio_net_blk module. The SOC side mainly performs storage packet disassembly, merging, order maintenance, and forwarding. The virtio_net module then forwards the packets to the optical port using the TCP protocol, connects to the remote switch and disk using optical fiber, and then performs block storage read and write operations.
[0047] Example 1
[0048] This embodiment discloses a transmission optimization method for a virtual storage controller, including:
[0049] Please refer to Figure 2 to see how the virtio_blk controller works:
[0050] It should be noted that when the client host needs to send data packets such as read and write instructions, the data packets are constructed into logical buffers, filled into the virtqueue, and the back-end is notified through the notify mechanism;
[0051] When the backend receives the notification, if it is not currently processing other data packets, it processes the request of the first queue, otherwise it waits for idleness; after the backend is idle, it takes out the bufferheadindex from the shared avail_ring of the first queue, finds the corresponding descriptor position in the descriptor table for the address, and obtains the starting information such as the starting address and length of the data to be sent from the corresponding descriptor.
[0052] Based on the starting information, the backend reads the data packet from the client host side and forwards it to the remote disk for reading and writing operations. After the disk read and write operations are completed, the corresponding completion information is returned. The backend fills the completion information into the buffer corresponding to the client host and updates the used_ring. The client host is notified by interruption. After receiving the interrupt, the client host obtains the updated index from the used_ring and determines whether there is corresponding return information in the buffer. If there is return information, it is directly taken away and the buffer space is released.
[0053] Please refer to Figure 3, which shows the architecture block diagram of the virtio_blk controller implemented within the FPGA. In this figure, the PCIe component is a module designed within the FPGA, serving as a bridge between the client host driver and the virtio_blk controller. This detailed description will not be provided here; this embodiment focuses on the virtio_blk controller.
[0054] The main function of the virtio_blk controller is to interact with the back-end device and the front-end, organize and forward a series of read and write operations initiated by the client host to the remote disk system, and move the read and write data of the client host to the remote disk;
[0055] The virtio_blk controller includes modules such as virtio_csr, virtio_adaptor, fetch_index, fetch_ring, fetch_desc, fetch_pkt, mate_builder, slot_adaptor, data_parser and updata_pkt;
[0056] The virtio_csr is a register module of virtio, which is used to cache the public configuration registers and specific configuration registers of the queue corresponding to the PF or VF. The virtio_csr is used for register interaction between the client host-side driver and the FPGA-side device, and is used for the control channel of the entire virtio. For example, virtio initialization, notify, interrupt, index, ring ring, descriptor corresponding to each virtual queue, and statistical debugging registers, etc., are all handled and connected by the virtio_csr.
[0057] The virtio_adaptor is a data channel merging and selection module that selects channels for multiple DMA read and write requests. When the virtio_blk controller initiates a DMA read and write request to the client host, it merges multiple request channels into one channel using RR polling to interact with the client host. When the client host responds to the read request of the virtio_blk controller, it splits the returned response data and returns it to the corresponding channel in the order of the previously recorded read requests.
[0058] The fetch_index function obtains the notify notification mechanism on the client host side to obtain the headindex in the shared ring of the virtual queue on the client host side; when a notify signal from the corresponding queue is received, the fetch_index function obtains the index of the corresponding queue on the client host side and transmits the obtained headindex to the fetch_ring;
[0059] fetch_ring: obtains the corresponding array value in the shared ring of the virtual queue on the client host side, the index of the array value is headindex, and the content is the index of the first descriptor linked list corresponding to index; when fetch_index inputs index related information, fetch_ring obtains the array value from the client host, that is, the position index of the first descriptor, and passes it to fetch_desc;
[0060] The fetch_desc: obtains the descriptor corresponding to the current headindex in the virtual queue on the client host side, driven by the array information transmitted by fetch_ring, the array contains the first label of the first descriptor in the descriptor linked list, finds the first descriptor corresponding to the index according to the first label, the first descriptor includes the second label of the second descriptor, and the second descriptor of the linked list is found by the second label. The second descriptor also includes the third label of the third descriptor position, and so on. According to the third label, all descriptor linked lists corresponding to the index are found, and the linked lists composed of complete descriptors corresponding to the same index of the same virtual queue are arranged in the order of front and back acquisitions, and are transmitted to mate_builder for processing in one go;
[0061] The mate_builder is a group header, and the descriptor linked list corresponding to the same index of the same queue is classified and transmitted. The mate_builder is driven by the descriptor linked list information transmitted by fetch_desc. After receiving the completed descriptor linked list, it is divided into two parts according to the flag bit in the descriptor. The first part is the descriptor of the write-only client host. The descriptors in the first part form a header and are transmitted to fetch_pkt. The second part is the descriptor of the read-only client host, which is also transmitted to fetch_pkt, and the descriptors of the read-only client host need to be consumed by fetch_pkt.
[0062] The fetch_pkt: obtains the read-only data on the client host side and assembles it into a package. fetch_pkt is driven by the two parts of descriptor information transmitted by mate_builder. fetch_pkt disassembles and analyzes the descriptor of the read-only client host, obtains the description data on the client host side according to the address + data length in the descriptor, and splices and merges the packet header composed of the description data and the write-only client host descriptor to form a storage packet of packet header + data, which is transmitted to slot_adaptor.
[0063] The slot_adaptor is the input and output module of the virtio_blk controller connecting to the remote disk. The slot_adaptor includes two functions. The first function is to add a first mark to the first storage packet input by fetch_pkt to indicate that a storage packet is a storage packet of the corresponding PF or VF virtual queue, so that the output storage packet is a complete packet; the second function is to receive the completion packet returned by the remote disk, parse the corresponding PF or VF queue information, and transmit the parsed result and the corresponding completion packet information to the data_parser module for processing.
[0064] The data_parser: parses the completion packet from the slot_adaptor. The data_parser is driven by the completion packet and other information transmitted by the slot_adaptor. When the completion packet is received, the first step is to strip off the header and data part. The second step is to parse out the write-only client host descriptor and other information carried in the header to obtain the parsing information; the third step is to transmit the parsing information and the remaining data part after stripping to updata_pkt.
[0065] The updata_pkt is used to monitor uploaded data, update the used_index on the client host side, and initiate interrupt information; updata_pkt is driven by information such as the parsing package transmitted by data_parser. When updata_pkt receives the parsing information and data, it writes the data in segments to the client host side memory according to the write-only client host descriptor in the parsing information. After writing the data, it updates the used_index of the shared ring on the client host side, and initiates an interrupt command to the client host to notify the client host that there is new data update.
[0066] From the initialization configuration of virtio_csr, fetch_index receives the notify notification from the client host, to updata_pkt sending an interrupt instruction to notify the client host that the read and write are completed, the virtio_blk controller completes a complete IO forwarding task.
[0067] When a storage packet is lost on the link between the virtio_blk controller and the SOC, the virtio_blk controller handles the following:
[0068] When the soc side is busy and cannot receive the storage packet sent by the virtio_blk controller, the storage packet is back-pressed to the client host side in a hierarchical manner inside the FPGA. If the soc side accidentally resets the transmission channel corresponding to virtio_net_blk, making the transmission channel invalid, the storage packet transmitted from the virtio_blk controller is lost. After virtio_net_blk is received by the soc side again, the storage packet can be transmitted again. To this end, breakpoint processing is performed inside the FPGA. Specifically, before restarting virtio_net_blk, the soc side actively sends a breakpoint message to the virtio_blk controller. The virtio_blk controller determines that the storage packet has been lost. Then the virtio_blk controller determines the location of the breakpoint through used_index and decides to re-initiate the transmission of the discarded IO. At the same time, the soc side must re-detect the location of the breakpoint.
[0069] When an abnormality on the SOC side causes forwarding storage packets to be lost, the virtio_blk controller handles the following:
[0070] The soc side forwards the storage packet using the TCP protocol and re-establishes the link for transmission. When an abnormality on the soc side causes the forwarded storage packet to be lost, the soc side initiates a retransmission instruction.
[0071] When a remote disk read / write exception occurs and no completion packet is returned, resulting in storage packet loss, the SOC side processing process includes:
[0072] A timeout mechanism is set on the SOC side. If the remote disk does not reply to the completion of the read or write operation within the preset time, the SOC side can actively build a completion packet and return it to the virtio_blk controller, and mark the status value at the end of the corresponding packet as an exception message. After receiving the corresponding exception message, the host handles it on its own to ensure that the entire transmission is not stuck. If the preset time is exceeded, the remote disk returns the completion message, and the SOC side deletes the exception message to avoid repeated and unnecessary errors.
[0073] This embodiment is based on the design and optimization of the virtio_blk controller of the SmartNIC. Compared with existing technologies, this embodiment implements some storage backend functions on the FPGA. This embodiment has high practicality and a clever design, solving the industry problem of lost IO. The design architecture is clear and concise, and consumes less FPGA on-chip resources.
[0074] Example 2
[0075] This embodiment, based on the first embodiment, sets the storage packet format in the viriio_blk controller.
[0076] It should be noted that due to the characteristics of storage IO operations, each read or write request must have a corresponding return notification, which is used to indicate whether the request command data operation is successful and carries the data information read back. The packet consisting of the request command data is a storage request packet, and the packet consisting of the return notification is a storage completion packet.
[0077] Please refer to Figure 4 for the format of the storage request packet output by the virtio_blk controller;
[0078] Figure 5 shows the format of the storage completion packet received by the virtio_blk controller from the remote end. The format addresses start at the upper right corner and increase from right to left until they reach the lower left corner. Each row is 512-bit aligned to facilitate processing within the FPGA. RSV and padding are used to fill a row corresponding to the 512-bit width.
[0079] Specifically, the format information of the storage package is described as follows:
[0080] As shown in Figure 1, virtio_net_head: The reserved 96-bit space is filled by virtio_net_blk when the storage packet is transmitted through virtio_net_blk, enabling interaction between virtio_net_blk and the SOC side;
[0081] PF+VF+qid: 32 bits wide, indicating that the storage packet belongs to the corresponding queue in the PF or VF on the client host side, which is equivalent to the identity tag of the storage packet;
[0082] Rsv: reserved bit, no actual function;
[0083] Information: indication information carried by the storage package, including a descriptor indicating that the storage package carries n write-only client hosts, an index value corresponding to the storage package, and package length information.
[0084] desc_0~desc_n: only write the descriptors of the client host. The specific number is specified by the information in information.
[0085] Padding: fills invalid bits to make up the 512-bit data width;
[0086] Type: Indicates whether the storage package is used for disk read operations or disk write operations;
[0087] Sector: Indicates the starting position of the sector for reading and writing disk;
[0088] write_data: data written to disk, the size of which is an integer multiple of 512 bytes and is placed at the end of the storage package;
[0089] read_data: reads data from disk, the size of which is an integer multiple of 512 bytes;
[0090] Status: Status indicator signal, indicating whether the operation is successful.
[0091] Example 3
[0092] Referring to FIG6 , this embodiment provides an electronic device, including: a processor and a memory, wherein the memory stores a computer program that can be called by the processor;
[0093] The processor executes the transmission optimization method of a virtual storage controller of embodiment 1 by calling the computer program stored in the memory.
[0094] Example 4
[0095] Please refer to FIG. 7 . This embodiment provides a computer-readable storage medium storing instructions. When the instructions are executed on a computer, the computer executes a transmission optimization method for a virtual storage controller according to embodiment 1.
[0096] The formulas involved in the above are all calculated by removing the dimensions and taking their numerical values. They are a formula that is closest to the actual situation obtained by collecting a large amount of data and performing software simulation. The weight factors in the formula and the various preset thresholds in the analysis process are set by technical personnel in this field according to actual conditions or obtained by simulating a large amount of data; the size of the weight factor is to quantify each parameter to obtain a specific value, which is convenient for subsequent comparison. The size of the weight factor depends on the amount of sample data and the corresponding processing coefficient initially set by technical personnel in this field for each group of sample data; as long as it does not affect the proportional relationship between the parameter and the quantized value.
[0097] The above embodiments can be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer program are loaded or executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired network. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes a set of one or more available media. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state drive.
[0098] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0099] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0100] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the units is only one type. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0101] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0102] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0103] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0104] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
[0105] Finally: The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application.
Claims
1. A transmission optimization method for a virtual storage controller, characterized in that: Applied to a virtio_blk controller, wherein the virtio_blk controller includes virtio_csr, virtio_adaptor, fetch_index, fetch_ring, fetch_desc, fetch_pkt, mate_builder, slot_adaptor, data_parser, and updata_pkt; When the storage packet of the link between the virtio_blk controller and the soc side is lost, the virtio_blk controller processes it; When an abnormality on the soc side causes the forwarding storage packet to be lost, the virtio_blk controller handles it; When the remote disk reads and writes abnormally and no completion packet is returned, resulting in storage packet loss, the soc side handles it.
2. The transmission optimization method of a virtual storage controller according to claim 1, characterized in that: The virtio_csr is a register module of virtio, which is used to cache the common configuration register and specific configuration register of the queue corresponding to the PF or VF; virtio_csr is used for register interaction between the driver on the client host side and the device on the FPGA side, and is used for the control channel of the entire virtio; The virtio_adaptor is a data channel merging and selecting module, which selects channels for multiple DMA read and write requests. When the virtio_blk controller initiates a DMA read and write request to the client host, multiple request channels are merged into one channel to interact with the client host using RR polling. When the client host responds to the read request of the virtio_blk controller, the returned response data is split and correctly returned to the corresponding channel according to the previously recorded read request order.
3. The transmission optimization method of the virtual storage controller according to claim 2, characterized in that: The fetch_index: obtains the notify notification mechanism on the client host side to obtain the headindex in the shared ring of the virtual queue on the client host side; when receiving the notify signal of the corresponding queue, fetch_index obtains the index of the corresponding queue on the client host side, and transmits the obtained headindex to the fetch_ring; The fetch_ring: obtains the corresponding array value in the shared ring of the virtual queue on the client host side, the index of the array value is headindex, and the content is the index of the first descriptor linked list corresponding to index; when fetch_index inputs index related information, fetch_ring obtains the array value from the client host, that is, the position index of the first descriptor, and passes it to fetch_desc.
4. The transmission optimization method of the virtual storage controller according to claim 3, characterized in that: The fetch_desc: obtains the descriptor corresponding to the current headindex in the virtual queue on the host side of the client, driven by the array information transmitted by fetch_ring, the array contains the first number of the first descriptor in the descriptor linked list, finds the first descriptor corresponding to the index according to the first number, the first descriptor includes the second number of the second descriptor, finds the second descriptor in the linked list by the second number, the second descriptor also includes the third number of the third descriptor position, finds all the descriptor linked lists corresponding to the index according to the third number, arranges the linked lists composed of complete descriptors corresponding to the same index of the same virtual queue in the order of acquisition, and transmits them to mate_builder for processing in one go; The mate_builder is a group header, and classifies and transmits the descriptor linked lists corresponding to the same index of the same queue. The mate_builder is driven by the descriptor linked list information transmitted by fetch_desc. When the completed descriptor list is received, it will be divided into two parts according to the flag bit in the descriptor; the first part is the descriptor of the write-only client host, and the descriptors in the first part form a packet header and are transmitted to fetch_pkt; the second part is the descriptor of the read-only client host, which is also transmitted to fetch_pkt, and the descriptors of the read-only client host need to be consumed by fetch_pkt.
5. The transmission optimization method of a virtual storage controller according to claim 4, characterized in that: The fetch_pkt: obtains the read-only data on the client host side and assembles the data into a packet; fetch_pkt is driven by the two parts of the descriptor information transmitted by mate_builder, and fetch_pkt disassembles and analyzes the descriptor of the read-only client host, obtains the description data on the client host side according to the address + data length in the descriptor, and splices and merges the packet header composed of the description data and the write-only client host descriptor to form a storage packet of the packet header + data, and transmits it to slot_adaptor; The slot_adaptor is an input and output module for the virtio_blk controller to connect to the remote disk. The slot_adaptor includes two functions. The first function is to add a first mark to the first storage packet input by fetch_pkt to show that a storage packet is a storage packet of the virtual queue of the corresponding PF or VF, so that the output storage packet is a complete packet. The second function is to receive the completion packet returned by the remote disk, parse out the corresponding PF or VF queue information, and transmit the parsing result and the corresponding completion packet information to the data_parser module for processing.
6. The transmission optimization method of a virtual storage controller according to claim 5, characterized in that: The data_parser: parses the completion packet from the slot_adaptor. The data_parser is driven by the completion packet information transmitted by the slot_adaptor. When the completion packet is received, the first step is to strip the header and the data part. The second step is to parse the write-only client host descriptor information carried in the header to obtain the parsing information. The third step is to transmit the parsing information and the remaining data part after stripping to updata_pkt. The updata_pkt is used to monitor uploaded data, update the used_index on the client host side, and initiate interrupt information; updata_pkt is driven by the parsing information transmitted by data_parser. When updata_pkt receives the parsing information and data, it writes the data in segments to the client host side memory according to the write-only client host descriptor in the parsing information. After writing the data, it updates the used_index of the shared ring on the client host side, and initiates an interrupt command to the client host to notify the client host that there is new data update.
7. The transmission optimization method of a virtual storage controller according to claim 6, characterized in that: When the storage packet of the link between the virtio_blk controller and the soc side is lost, the processing process of the virtio_blk controller includes: When the soc side is busy and cannot receive the storage packet sent by the virtio_blk controller, the storage packet is back-pressed to the client host side in a hierarchical manner inside the FPGA. If the soc side accidentally resets the transmission channel corresponding to the virtio_net_blk, making the transmission channel invalid, the storage packet transmitted from the virtio_blk controller is lost. After the virtio_net_blk is received by the soc side again, the storage packet is continued to be transmitted. For this reason, the FPGA performs breakpoint processing inside. Specifically, before restarting virtio_net_blk, the soc side actively sends a breakpoint message to the virtio_blk controller. The virtio_blk controller determines that the storage packet is lost. Then the virtio_blk controller determines the position of the breakpoint through used_index, and determines to re-initiate the transmission of the discarded IO. At the same time, the soc side has to re-detect the position of the breakpoint.
8. The transmission optimization method of a virtual storage controller according to claim 7, characterized in that: When an abnormality on the soc side causes the forwarding storage packet to be lost, the processing process of the virtio_blk controller includes: The soc side forwards the storage packet using the TCP protocol and re-establishes the link for transmission. When an abnormality on the soc side causes the forwarded storage packet to be lost, the soc side initiates a retransmission instruction.
9. The transmission optimization method of a virtual storage controller according to claim 8, characterized in that: When the remote disk reads and writes abnormally and no completion packet is returned, resulting in storage packet loss, the SOC side processing process includes: A timeout mechanism is set on the soc side. If the remote disk does not reply whether the read or write operation is completed within the preset time, the soc side can actively build a completion packet and return it to the virtio_blk controller, and mark the status value at the end of the corresponding packet as abnormal information. After the host receives the corresponding abnormal information, it handles it by itself to ensure that the entire transmission is not stuck. If the preset time is exceeded, the remote disk returns the completion information. At the same time, the soc side deletes the abnormal information to avoid repeated unnecessary errors.
10. An electronic device, characterized in that: include: A processor and a memory, wherein the memory stores a computer program that can be called by the processor; The processor executes the transmission optimization method of the virtual storage controller according to any one of claims 1 to 9 by calling the computer program stored in the memory.
Citation Information
Patent Citations
Method, device and equipment for acquiring descriptor by back-end equipment and readable medium
CN113609055A
Network card and method for processing data by network card
CN113778320A
Para-virtualization device-based data processing method, device and system
CN114637574A
Storage breakpoint resuming method and system on intelligent network card
CN116107805A
Transmission optimization method based on Virtio-net
CN116346737A
Cited By
SoC module automatic interconnection method, device, equipment and medium
CN122285600A