Simulation method and device of host bus adapter, electronic equipment and storage medium
A software simulation method for HBAs decouples hardware and driver development, shortening the development cycle and facilitating fault tolerance verification.
Patent Information
- Application Number
- CN202411195336.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-28
- Publication Date
- 2024-12-13
AI Technical Summary
The driver development and debugging of Host Bus Adapters (HBAs) rely on hardware, leading to a long development cycle.
A software simulation method for HBAs is developed, utilizing a virtual host driver, system, and database to simulate initialization and input/output behaviors without hardware dependency, enabling decoupling of hardware and driver development.
This approach shortens the driver development cycle and allows flexible verification of system fault tolerance capabilities.
Smart Images

Figure CN119127395A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software simulation, and in particular to a simulation method, device, electronic equipment and storage medium of a host bus adapter. Background Art
[0002] Host Bus Adapter (HBA) is an integrated adapter used to provide input / output functions between servers and storage devices. It generally refers to input and output (IO) cards that support the Internet Small Computer System Interface (SCSI) protocol, such as Fibre Channel (FC) cards and Serial Attached SCSI (SAS) cards. HBA cards are widely used in storage interconnection scenarios due to their high performance, low latency, high reliability, scalability and security.
[0003] Currently, the driver development of HBA cards depends on the hardware HBA cards, and the driver code development and debugging must be completed in conjunction with the hardware HBA cards, resulting in a long driver development cycle. Summary of the invention
[0004] The present invention provides a host bus adapter simulation method, device, electronic device and storage medium, which are used to solve the defects in the prior art that the driver development of an HBA card depends on a hardware HBA card, the driver code development and debugging must be completed in conjunction with the hardware HBA card, and the driver development cycle is long. The present invention can realize software simulation of a host bus adapter, so that the development and debugging of a driver module of the host bus adapter can be realized without relying on the hardware host bus adapter, thereby realizing the decoupling of hardware and driver development and shortening the driver development cycle.
[0005] The present invention provides a host bus adapter simulation method, comprising: Simulating the initialization behavior of the host bus adapter based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database; Based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database, the input and output service behaviors of the host bus adapter are simulated.
[0006] According to a host bus adapter simulation method provided by the present invention, the virtual host bus adapter system database is constructed by the following steps: Construct a network message data source based on the historical network message data captured from historical projects; Based on the mapping data between each register and event extracted from the manufacturer's manual and the configuration data of each queue, a register group event mapping data set is constructed; The virtual host bus adapter system database is constructed based on the network message data source and the register group event mapping data set.
[0007] According to a host bus adapter simulation method provided by the present invention, the virtual host driver includes an input and output service module and a configuration module, and the virtual host bus adapter system includes a host memory queue, a core register group, a data access module, a fault injection control module and a register group; The simulating of the initialization behavior of the host bus adapter based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database includes: An initialization command is issued through the configuration module, and the initialization command reaches the register group through the core register group, the data access module and the fault injection control module; querying the initialization result of the core register group after executing the initialization command from the register group event mapping data set through the register group; Feeding back the initialization result of the core register group to the configuration module; Writing the initialization result of the core register group into the core register group through the configuration module; Sending a queue configuration command through the configuration module, the queue configuration command passes through the core register group, the data access module and the fault injection control module to reach the register group; querying the configuration data of the host memory queue from the register group event mapping data set through the register group; Feeding back the configuration data of the host memory queue to the input and output service module; The host memory queue is configured according to the configuration data of the host memory queue by the input / output service module.
[0008] According to a host bus adapter simulation method provided by the present invention, the virtual host bus adapter system further comprises: a network message cache translation module, an event queue data module and a response queue data module; the host memory queue comprises a request queue, a response queue and an event queue; the core register group comprises a status register, a queue pointer register, a mailbox message sending register and a mailbox message receiving register; The simulating the input and output service behaviors of the host bus adapter based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database includes: Inputting the historical network message data into the network message cache translation module through the network message data source; The historical network message data is translated into an input-output description control block by the network message cache translation module, and the input-output description control block is stored in the event queue data module; The input / output description control block is converted into event queue data by the event queue data module and then transmitted to the event queue; Modifying an entry pointer of the event queue, and modifying the status register to indicate that the virtual host driver has unread events; Searching the latest event queue data based on the dequeue pointer of the event queue by the virtual host driver to determine the SCSI command; Responding to the SCSI command through the virtual host driver, and sending the input / output service command to the request queue through the input / output service module; After the input / output service command in the request queue is detected by the virtual host bus adapter system, the input / output service command is simulated and executed, and the simulation execution result of the input / output service command is obtained from the response queue data module; delivering the simulated execution result of the input / output service command to the response queue; Modifying the queue entry pointer of the response queue, and modifying the status register to indicate that the current virtual host bus adapter service input and output is completed; The virtual host driver polls the status register, and after determining that the virtual host bus adapter service input and output is completed, the simulation execution result of the input and output service command is obtained based on the dequeue pointer of the response queue.
[0009] A host bus adapter simulation method provided by the present invention further includes: The fault injection control module is used to modify different data that needs to be returned to the upper module through the data access module to simulate different types of fault injection.
[0010] A host bus adapter simulation method provided by the present invention further includes: A fault injection control unit is constructed on the upper layer of the real host memory queue space and the real register address mapping space; Constructing a virtual host memory queue space and a virtual register address mapping space at an upper layer of the fault injection control unit; Modify the data of the virtual host memory queue space and the virtual register address mapping space by the fault injection control unit; synchronizing the modified data to the host bus adapter system; The response data of the host bus adapter system is returned to the virtual host memory queue space and the virtual register address mapping space, and fed back to the host driver to simulate fault injection.
[0011] The present invention also provides a host bus adapter simulation device, comprising: A first simulation module, for simulating the initialization behavior of the host bus adapter based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database; The second simulation module is used to simulate the input and output service behaviors of the host bus adapter based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database.
[0012] The present invention also provides an electronic device, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the above-mentioned host bus adapter simulation methods when executing the computer program.
[0013] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the method for simulating a host bus adapter as described in any one of the above is implemented.
[0014] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method for simulating a host bus adapter as described in any one of the above is implemented.
[0015] The host bus adapter simulation method, device, electronic device and storage medium provided by the present invention first simulate the initialization behavior of the host bus adapter based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database; then, based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database, the input and output service behaviors of the host bus adapter are simulated, so that the software simulation of the host bus adapter can be realized, so that the development and debugging of the driver module of the host bus adapter can be realized without relying on the hardware host bus adapter, thereby realizing the decoupling of hardware and driver development and shortening the driver development cycle. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 It is a flowchart of a method for simulating a host bus adapter provided by an embodiment of the present invention.
[0018] Figure 2 It is a schematic diagram of the architecture of a host bus adapter emulation system provided by an embodiment of the present invention.
[0019] Figure 3 It is a schematic diagram of a fault injection method combining software and hardware provided in an embodiment of the present invention.
[0020] Figure 4 It is a schematic diagram of the structure of a simulation device for a host bus adapter provided by an embodiment of the present invention.
[0021] Figure 5 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0023] Combine the following Figure 1-Figure 3 The host bus adapter simulation method of the present invention is described.
[0024] Please refer to Figure 1 , Figure 1 FIG. 1 is a flow chart of a method for simulating a host bus adapter provided by an embodiment of the present invention. Figure 1 As shown, the method may include step 101 and step 102.
[0025] Step 101: Simulate the initialization behavior of a host bus adapter based on a virtual host driver, a virtual host bus adapter system and a virtual host bus adapter system database.
[0026] Specifically, Figure 2As shown, the host bus adapter emulation system includes a virtual host driver 1 , a virtual host bus adapter system 2 and a virtual host bus adapter system database 3 .
[0027] In one embodiment, a virtual host bus adapter system database 3 is constructed by the following steps: based on the historical network message data captured from the historical project, a network message data source 31 is constructed; based on the mapping data between each register and event and the configuration data of each queue extracted from the manufacturer's manual, a register group event mapping data set 32 is constructed; based on the network message data source 31 and the register group event mapping data set 32, a virtual host bus adapter system database 3 is constructed, which can improve the accuracy of the simulation.
[0028] Exemplarily, taking the FC card as an example, the analyzer captures the fabric login (FabricLogin, FLOGI) message, port login (Port Login, PLOGI) message, process login (Process Login, PRLI) message and SCSI layer interaction message from the historical project, and then constructs the network message data source 31 based on these messages.
[0029] In one embodiment, if Figure 2 As shown, the virtual host driver 1 includes an input / output service module 11 and a configuration module 12 , and the virtual host bus adapter system 2 includes a host memory queue 21 , a core register group 22 , a data access module 23 , a fault injection control module 24 and a register group 25 .
[0030] Step 101 may include the following sub-steps: The configuration module 12 issues an initialization command, which passes through the core register group 22, the data access module 23 and the fault injection control module 24 to reach the register group 25; Query the initialization result of the core register group 22 after executing the initialization command from the register group event mapping data set 32 through the register group 25; Feedback the initialization result of the core register group 22 to the configuration module 12; Writing the initialization result of the core register group 22 into the core register group 22 through the configuration module 12; The queue configuration command is issued by the configuration module 12, and the queue configuration command passes through the core register group 22, the data access module 23 and the fault injection control module 24 to reach the register group 25; Query the configuration data (e.g., the address and size of the memory) of the host memory queue 21 from the register group event mapping data set 32 through the register group 25; Feedback the configuration data of the host memory queue 21 to the input / output service module 11; The host memory queue 21 is configured according to the configuration data of the host memory queue 21 through the input / output service module 11 .
[0031] In this embodiment, initialization commands and queue configuration commands can be issued through the configuration path to query the initialization result of the core register group 22 and the configuration data of the host memory queue 21 from the register group event mapping data set 32. The configuration module 12 is responsible for writing the initialization result of the core register group 22 into the core register group 22, and the input and output service module 11 is responsible for configuring the host memory queue 21 according to the configuration data of the host memory queue 21, thereby realizing the simulation of the initialization behavior of the host bus adapter.
[0032] Step 102: Simulate the input and output service behaviors of the host bus adapter based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database.
[0033] In one embodiment, if Figure 2 As shown, the virtual host bus adapter system 2 also includes: a network message cache translation module 26, an event queue data module 27 and a response queue data module 28; the host memory queue 21 includes a request queue, a response queue and an event queue; the core register group 22 includes a status register, a queue pointer register, a mailbox message sending register and a mailbox message receiving register.
[0034] Step 102 may include the following sub-steps: Inputting historical network message data to the network message cache translation module 26 through the network message data source 31; The historical network message data is translated into input and output description control blocks by the network message cache translation module 26, and the input and output description control blocks are stored in the event queue data module 27; The input and output description control block is converted into event queue data by the event queue data module 27 and then transmitted to the event queue; Modify the queue pointer of the event queue and modify the status register to indicate that there are unread events in the virtual host driver 1; Find the latest event queue data based on the dequeue pointer of the event queue through the virtual host driver 1 to determine the SCSI command; Respond to SCSI commands through the virtual host driver 1, and send input and output service commands to the request queue through the input and output service module 11; After the input / output service command in the request queue is detected by the virtual host bus adapter system 2, the input / output service command is simulated and executed, and the simulation execution result of the input / output service command is obtained from the response queue data module 28; Deliver the simulated execution results of the input and output service commands to the response queue; Modify the queue pointer of the response queue, and modify the status register to indicate that the input and output of this virtual host bus adapter service is completed; By polling the status register through the virtual host driver 1, after determining that the virtual host bus adapter service input and output is completed, the simulation execution result of the input and output service command is obtained based on the dequeue pointer of the response queue.
[0035] In this embodiment, the simulation of the input and output service behaviors of the host bus adapter can be implemented.
[0036] In one embodiment, the method further includes: modifying, by the fault injection control module 24, different data that needs to be returned to the upper module through the data access module 23, so as to simulate different types of fault injection.
[0037] Specifically, during the simulation operation of the host bus adapter simulation system 200, all interactive data are obtained through the data access module 23 via the fault injection control module 24. The data that needs to be returned to the upper layer module can be randomly modified by the fault injection control module 24, thereby simulating the corresponding fault injection. The upper layer module may include a host memory queue 21, a core register group 22, an input and output service module 11, and a configuration module 12.
[0038] Exemplarily, by randomly modifying the configuration data of the host memory queue by the fault injection control module 24, the fault injection of abnormal host bus adapter configuration response can be simulated. By randomly modifying the simulated execution results of the input and output service commands by the fault injection control module 24, the fault injection of abnormal host bus adapter input and output service can be simulated. By randomly modifying the event queue data by the fault injection control module 24, the fault injection of the host bus adapter error event report can be simulated. In this way, different types of fault injection can be simulated by modifying different data.
[0039] In this embodiment, the simulation of fault injection can be implemented by pure software.
[0040] In one embodiment, if Figure 3As shown, the method also includes: constructing a fault injection control unit 303 on the upper layer of the real host memory queue space 301 and the real register address mapping space 302; constructing a virtual host memory queue space 304 and a virtual register address mapping space 305 on the upper layer of the fault injection control unit 303; modifying the data of the virtual host memory queue space 304 and the virtual register address mapping space 305 through the fault injection control unit 303; synchronizing the modified data to the host bus adapter system 306; returning the response data of the host bus adapter system 306 to the virtual host memory queue space 304 and the virtual register address mapping space 305, and feeding back to the host driver 307 to simulate fault injection.
[0041] Specifically, since a layer of virtual host memory queue space 304 and virtual register address mapping space 305 data is constructed, when simulating fault injection, the data of the virtual host memory queue space 304 and virtual register address mapping space 305 are modified by the fault injection control unit 303, and then synchronized to the host bus adapter system 306, so as to achieve the issuance of chaotic instructions, and the response data of the real host bus adapter system 306 after receiving the erroneous instruction is returned to the virtual host memory queue space 304 and virtual register address mapping space 305, and fed back to the host driver 307, so as to realize the injection of real HBA card faults.
[0042] In this embodiment, the injection of a real HBA card fault can be achieved by combining software and hardware.
[0043] The host bus adapter simulation method provided by the embodiment of the present invention first simulates the initialization behavior of the host bus adapter based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database; then, based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database, the input and output service behaviors of the host bus adapter are simulated, so that the software simulation of the host bus adapter can be realized, so that the development and debugging of the driver module of the host bus adapter can be realized without relying on the hardware host bus adapter, thereby realizing the decoupling of hardware and driver development and shortening the driver development cycle.
[0044] Furthermore, by utilizing the software virtualized host bus adapter simulation system, the response result of the host bus adapter to the upper layer command can be flexibly controlled, thereby facilitating the verification of the system fault tolerance capability.
[0045] The simulation device of the host bus adapter provided by the present invention is described below. The simulation device of the host bus adapter described below and the simulation method of the host bus adapter described above can be referred to each other.
[0046] Please refer to Figure 4 , Figure 4 FIG. 1 is a schematic diagram of the structure of a simulation device for a host bus adapter provided by an embodiment of the present invention. Figure 4 As shown, the device may include: A first simulation module 401 is used to simulate the initialization behavior of the host bus adapter based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database; The second simulation module 402 is used to simulate the input and output service behaviors of the host bus adapter based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database.
[0047] In one embodiment, a building block is further included, specifically for: Construct a network message data source based on the historical network message data captured from historical projects; Based on the mapping data between each register and event extracted from the manufacturer's manual and the configuration data of each queue, a register group event mapping data set is constructed; A virtual host bus adapter system database is constructed based on a network message data source and a register group event mapping data set.
[0048] In one embodiment, the virtual host driver includes an input / output service module and a configuration module, and the virtual host bus adapter system includes a host memory queue, a core register set, a data access module, a fault injection control module, and a register set; The first simulation module 401 is specifically used for: The initialization command is sent through the configuration module, and the initialization command reaches the register group through the core register group, the data access module and the fault injection control module; Querying the initialization result of the core register group after executing the initialization command from the register group event mapping data set through the register group; Feedback the initialization result of the core register group to the configuration module; Writing the initialization result of the core register group into the core register group through the configuration module; The queue configuration command is sent through the configuration module, and the queue configuration command reaches the register group through the core register group, the data access module and the fault injection control module; querying the configuration data of the host memory queue from the register group event mapping data set through the register group; Feedback the configuration data of the host memory queue to the input and output service module; The host memory queue is configured according to the configuration data of the host memory queue through the input and output service module.
[0049] In one embodiment, the virtual host bus adapter system further comprises: a network message cache translation module, an event queue data module and a response queue data module; the host memory queue comprises a request queue, a response queue and an event queue; the core register group comprises a status register, a queue pointer register, a mailbox message sending register and a mailbox message receiving register; The second simulation module 402 is also used for: Inputting historical network message data into the network message cache translation module through the network message data source; The historical network message data is translated into input and output description control blocks through the network message cache translation module, and the input and output description control blocks are stored in the event queue data module; The input and output description control block is converted into event queue data through the event queue data module and then passed to the event queue; Modify the entry pointer of the event queue and modify the status register to indicate to the virtual host driver that there are unread events; Find the latest event queue data based on the dequeue pointer of the event queue through the virtual host driver to determine the small computer system interface command; Respond to SCSI commands through the virtual host driver and send input and output service commands to the request queue through the input and output service module; After the input / output service command in the request queue is detected by the virtual host bus adapter system, the input / output service command is simulated and executed, and the simulation execution result of the input / output service command is obtained from the response queue data module; Deliver the simulated execution results of the input and output service commands to the response queue; Modify the queue pointer of the response queue, and modify the status register to indicate that the input and output of this virtual host bus adapter service is completed; The virtual host driver polls the status register, and after determining that the virtual host bus adapter service input and output is completed, the simulated execution result of the input and output service command is obtained based on the dequeue pointer of the response queue.
[0050] In one embodiment, it also includes: The first fault simulation module is used to modify different data that needs to be returned to the upper module through the data access module through the fault injection control module to simulate different types of fault injection.
[0051] In one embodiment, a second fault simulation module is further included, which is specifically used to: A fault injection control unit is constructed on the upper layer of the real host memory queue space and the real register address mapping space; Constructing a virtual host memory queue space and a virtual register address mapping space on the upper layer of the fault injection control unit; Modify data of the virtual host memory queue space and the virtual register address mapping space through the fault injection control unit; synchronizing the modified data to the host bus adapter system; The response data of the host bus adapter system is returned to the virtual host memory queue space and the virtual register address mapping space, and fed back to the host driver to simulate fault injection.
[0052] Figure 5 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 5 As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530 and a communication bus 540, wherein the processor 510, the communication interface 520 and the memory 530 communicate with each other through the communication bus 540. The processor 510 may call the logic instructions in the memory 530 to execute the simulation method of the host bus adapter, which includes: simulating the initialization behavior of the host bus adapter based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database; simulating the input and output service behavior of the host bus adapter based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database.
[0053] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, 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, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0054] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the host bus adapter simulation method provided by the above-mentioned method embodiments, the method including: simulating the initialization behavior of the host bus adapter based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database; simulating the input and output service behavior of the host bus adapter based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database.
[0055] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it is implemented to execute the host bus adapter simulation method provided by the above-mentioned method embodiments. The method includes: based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database, simulating the initialization behavior of the host bus adapter; based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database, simulating the input and output service behavior of the host bus adapter.
[0056] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0057] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0058] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for emulating a host bus adapter, It is characterized in that include: Simulating the initialization behavior of the host bus adapter based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database; Based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database, the input and output service behaviors of the host bus adapter are simulated.
2. The host bus adapter simulation method according to claim 1, It is characterized in that The virtual host bus adapter system database is constructed by following the steps below: Construct a network message data source based on the historical network message data captured from historical projects; Based on the mapping data between each register and event extracted from the manufacturer's manual and the configuration data of each queue, a register group event mapping data set is constructed; The virtual host bus adapter system database is constructed based on the network message data source and the register group event mapping data set.
3. The host bus adapter simulation method according to claim 2, It is characterized in that The virtual host driver includes an input and output service module and a configuration module, and the virtual host bus adapter system includes a host memory queue, a core register group, a data access module, a fault injection control module and a register group; The simulating of the initialization behavior of the host bus adapter based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database includes: An initialization command is issued through the configuration module, and the initialization command reaches the register group through the core register group, the data access module and the fault injection control module; querying the initialization result of the core register group after executing the initialization command from the register group event mapping data set through the register group; Feeding back the initialization result of the core register group to the configuration module; Writing the initialization result of the core register group into the core register group through the configuration module; Sending a queue configuration command through the configuration module, the queue configuration command passes through the core register group, the data access module and the fault injection control module to reach the register group; querying the configuration data of the host memory queue from the register group event mapping data set through the register group; Feeding back the configuration data of the host memory queue to the input and output service module; The host memory queue is configured according to the configuration data of the host memory queue by the input / output service module.
4. The host bus adapter simulation method according to claim 3, It is characterized in that The virtual host bus adapter system further comprises: a network message cache translation module, an event queue data module and a response queue data module; the host memory queue comprises a request queue, a response queue and an event queue; the core register group comprises a status register, a queue pointer register, a mailbox message sending register and a mailbox message receiving register; The simulating the input and output service behaviors of the host bus adapter based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database includes: Inputting the historical network message data into the network message cache translation module through the network message data source; The historical network message data is translated into an input-output description control block by the network message cache translation module, and the input-output description control block is stored in the event queue data module; The input / output description control block is converted into event queue data by the event queue data module and then transmitted to the event queue; Modifying an entry pointer of the event queue, and modifying the status register to indicate that the virtual host driver has unread events; Searching the latest event queue data based on the dequeue pointer of the event queue by the virtual host driver to determine the SCSI command; Responding to the SCSI command through the virtual host driver, and sending the input / output service command to the request queue through the input / output service module; After the input / output service command in the request queue is detected by the virtual host bus adapter system, the input / output service command is simulated and executed, and the simulation execution result of the input / output service command is obtained from the response queue data module; delivering the simulated execution result of the input / output service command to the response queue; Modifying the queue entry pointer of the response queue, and modifying the status register to indicate that the current virtual host bus adapter service input and output is completed; The virtual host driver polls the status register, and after determining that the virtual host bus adapter service input and output is completed, the simulation execution result of the input and output service command is obtained based on the dequeue pointer of the response queue.
5. The host bus adapter simulation method according to claim 4, It is characterized in that Also includes: The fault injection control module is used to modify different data that needs to be returned to the upper module through the data access module to simulate different types of fault injection.
6. The host bus adapter simulation method according to claim 1, It is characterized in that Also includes: A fault injection control unit is constructed on the upper layer of the real host memory queue space and the real register address mapping space; Constructing a virtual host memory queue space and a virtual register address mapping space at an upper layer of the fault injection control unit; Modify the data of the virtual host memory queue space and the virtual register address mapping space by the fault injection control unit; synchronizing the modified data to the host bus adapter system; The response data of the host bus adapter system is returned to the virtual host memory queue space and the virtual register address mapping space, and fed back to the host driver to simulate fault injection.
7. A host bus adapter simulation device, It is characterized in that include: A first simulation module, for simulating the initialization behavior of the host bus adapter based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database; The second simulation module is used to simulate the input and output service behaviors of the host bus adapter based on the virtual host driver, the virtual host bus adapter system and the virtual host bus adapter system database.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the host bus adapter simulation method according to any one of claims 1 to 6 is implemented.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the host bus adapter simulation method according to any one of claims 1 to 6 is implemented.
10. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the host bus adapter simulation method according to any one of claims 1 to 6 is implemented.
