Data access method and apparatus

By identifying the remaining storage capacity and the cumulative number of writes in the network interface card (NIC) device, and constructing data packets, the problem of low data storage efficiency caused by frequent interactions between the NIC device and the host device is solved, achieving low-latency and high-efficiency data storage.

CN116069256BActive Publication Date: 2025-12-16HUNDSUN TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310129466.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-13
Publication Date
2025-12-16
Estimated Expiration
2043-02-13

AI Technical Summary

Technical Problem

In existing technologies, frequent data interaction between network interface cards (NICs) and host devices leads to low data storage efficiency and fails to meet the low latency requirements of the financial communications field.

Method used

The network interface card (NIC) device receives storage space information requested by the host device, identifies the remaining storage capacity, accumulates the number of writes, constructs data packets, and sends the data packets to the host device when the number of writes changes. The host device then stores the data in the storage space based on the starting address, reducing the number of interactions.

Benefits of technology

It reduces data interaction between the host device and the network card device, reduces data storage latency, improves data storage efficiency, and ensures orderly data storage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116069256B_ABST
    Figure CN116069256B_ABST
Patent Text Reader

Abstract

The present specification provides a data access method and device, wherein the data access method comprises: receiving storage space information applied by a host device from a memory, wherein the storage space information comprises a start address and a storage capacity of the storage space; identifying whether a remaining storage capacity of the storage space meets storage of to-be-stored data according to a data length of the to-be-stored data, a data length of stored data and the storage capacity; if not, accumulating a write number of the storage space; constructing a data packet based on the write number and the to-be-stored data; and sending the data packet to the host device, so that the host device stores the to-be-stored data into the storage space based on the write number, wherein in the case of a change in the write number, the host device stores the to-be-stored data into the storage space based on the start address. In this way, the data interaction between the host device and the network card device is reduced, the time delay of data storage is reduced, and the efficiency of data storage is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present specification relates to the technical field of data processing, in particular to a data access method and device. BACKGROUND

[0002] In the field of financial communication, especially in the field of ultra-fast market, the received market data of the exchange needs to be transmitted to the software through the network card device as soon as possible. In the prior art, after the host device applies for a storage space from the memory, the base address of the storage space is sent to the network card device. The network card device reads the descriptor of the storage space to the host device every time it receives data, and writes the data into the host device according to the address in the descriptor. Since the network card device needs to interact with the host side multiple times every time it receives new data, this will introduce a large delay and reduce the efficiency of data storage. SUMMARY

[0003] Therefore, the embodiments of the present specification provide a data access method. The present specification also relates to a data access device, a computing device, and a computer readable storage medium to solve the technical defects in the prior art.

[0004] According to a first aspect of the embodiments of the present specification, a data access method is provided, applied to a network card device, comprising:

[0005] receiving storage space information applied by a host device from a memory, wherein the storage space information comprises a starting address and a storage capacity of a storage space;

[0006] According to the data length of the to-be-stored data, the data length of the stored data, and the storage capacity, it is identified whether the remaining storage capacity of the storage space meets the storage of the to-be-stored data;

[0007] If not, the write number of times of the storage space is accumulated;

[0008] Based on the write number of times and the to-be-stored data, a data packet is constructed;

[0009] The data packet is sent to the host device, so that the host device stores the to-be-stored data into the storage space based on the write number of times. In the case where the write number of times changes, the host device stores the to-be-stored data into the storage space based on the starting address.

[0010] According to a second aspect of the embodiments of the present specification, a data access method is provided, applied to a host device, comprising:

[0011] receiving a data packet of to-be-stored data sent by a network card device, wherein the data packet comprises a write number of times of a storage space and the to-be-stored data;

[0012] In a case where the written number of times is determined to change, the data to be stored is stored into the storage space based on a start address of the storage space.

[0013] According to a third aspect of the embodiments of the present specification, a data access apparatus is provided, applied to a network card device, comprising:

[0014] The first receiving module is configured to receive storage space information applied for by the host device from the memory, wherein the storage space information comprises a start address and a storage capacity of the storage space;

[0015] The identification module is configured to identify whether the remaining storage capacity of the storage space meets the storage of the data to be stored according to the data length of the data to be stored, the data length of the stored data and the storage capacity;

[0016] The number of times accumulation module is configured to accumulate the written number of times of the storage space if not.

[0017] The construction module is configured to construct a data packet based on the written number of times and the data to be stored.

[0018] The sending module is configured to send the data packet to the host device, so that the host device stores the data to be stored into the storage space based on the written number of times, wherein in a case where the written number of times changes, the host device stores the data to be stored into the storage space based on the start address.

[0019] According to a fourth aspect of the embodiments of the present specification, a data access apparatus is provided, applied to a host device, comprising:

[0020] The second receiving module is configured to receive a data packet of data to be stored sent by the network card device, wherein the data packet comprises a written number of times of a storage space and the data to be stored.

[0021] The data storage module is configured to store the data to be stored into the storage space based on a start address of the storage space in a case where the written number of times is determined to change.

[0022] According to a fifth aspect of the embodiments of the present specification, a computing device is provided, comprising:

[0023] A memory and a processor;

[0024] The memory is configured to store computer executable instructions, and the processor is configured to execute the computer executable instructions to implement the data access method of the first aspect or the second aspect.

[0025] According to a fourth aspect of the embodiments of the present specification, a computer readable storage medium is provided, which stores computer executable instructions, and the instructions, when executed by a processor, implement the steps of the data access method of the first aspect or the second aspect.

[0026] The data access method provided in the present specification receives storage space information applied for from the memory by the host device, wherein the storage space information comprises a start address and a storage capacity of the storage space; according to a data length of the to-be-stored data, a data length of the stored data and the storage capacity, it is identified whether the remaining storage capacity of the storage space meets the storage of the to-be-stored data; if not, the write times of the storage space are accumulated; based on the write times and the to-be-stored data, a data packet is constructed; the data packet is sent to the host device, so that the host device stores the to-be-stored data into the storage space based on the write times, wherein in the case that the write times change, the host device stores the to-be-stored data into the storage space based on the start address. Through the above method, the host device only needs to send the storage space information to the network card device once, the network card device can cyclically write data into the storage space according to the storage space information, the to-be-stored data and the data length of the stored data, and record the write times of the storage space, and in the case that the remaining storage capacity of the storage space cannot store the to-be-stored data, the write times of the storage space are accumulated, the write times and the to-be-stored data are sent to the host device, so that the host device stores the to-be-stored data based on the start address in the case that the write times change, not only reducing the data interaction between the host device and the network card device, reducing the time delay of data storage, improving the efficiency of data storage, but also storing the to-be-stored data according to the write times, which can orderly store data and also can improve the efficiency of data storage to a certain extent. BRIEF DESCRIPTION OF DRAWINGS

[0027] Figure 1 is a flowchart of a data storage method provided by the prior art;

[0028] Figure 2 is a schematic diagram of a data access system executing a data access method according to an embodiment of the present specification;

[0029] Figure 3 is a flowchart of a data access method according to an embodiment of the present specification;

[0030] Figure 4 is a flowchart of another data access method according to an embodiment of the present specification;

[0031] Figure 5 is a processing flowchart of a data access method applied to the field of financial communication according to an embodiment of the present specification;

[0032] Figure 6 is a schematic diagram of data access according to an embodiment of the present specification;

[0033] Figure 7 is a structural schematic diagram of a data access device provided by an embodiment of the present specification;

[0034] Figure 8 is a structural schematic diagram of another data access device provided by an embodiment of the present specification;

[0035] Figure 9 is a structural block diagram of a computing device provided by an embodiment of the present specification. DETAILED DESCRIPTION

[0036] In the following description, numerous specific details are set forth in order to provide a thorough understanding of the present specification. However, the present specification can be practiced without the specific details, other than in the examples described herein. Those of ordinary skill in the art, and others, can readily ascertain combinations and sub-combinations of the various features set forth in the description, without departing from the scope of the present specification. Accordingly, the present specification is not limited to the examples described herein.

[0037] The terminology used in this description of one or more embodiments of the present specification is for the purpose of describing particular embodiments only and is not intended to be limiting of one or more embodiments of the present specification. As used in this description and the appended claims of one or more embodiments of the present specification, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.

[0038] It will be understood that, although the terms first, second, etc. can be used herein to describe various information, these terms are not intended to denote a temporal or chronological order. Rather, these terms are used solely to distinguish one from another only. For example, without departing from the scope of one or more embodiments of the present specification, first can be termed second, and similarly, second can be termed first. Depending on the context, the word "if' as used herein can be interpreted to mean "when" or "in response to determining" or "in response to a determination".

[0039] First, the noun terms related to one or more embodiments of the present specification are explained.

[0040] PCIe (Peripheral Component Interconnect Express): a high-speed serial computer expansion bus standard.

[0041] Number of times of writing: the number of times of continuing to write data from the start address after the storage space is full.

[0042] Read times: the number of times of reading data from the start address after the data in the storage space is read completely.

[0043] Secondly, the application scenario of the data access method provided by the embodiment of the present specification is described.

[0044] In the field of financial communication, especially in the field of ultra-fast market, the received market data of the exchange needs to be sent to the software through the network card as soon as possible. The PCIe channel is the main way for the network card data to send software, and is also the main source of delay of the entire receiving link. Reducing the delay of data through PCIe can significantly reduce the delay of the receiving link.

[0045] Figure 1 is a flowchart of a data storage method provided by the prior art. Referring to Figure 1 , the flow of the data storage is as follows:

[0046] 1. The software applies for a plurality of storage spaces (buf) for receiving data in the memory of the host device (such as memory buf1, buf2, buf3, buf4, buf5) and generates descriptors (Descriptor) describing the addresses and lengths of the storage spaces, and stores the descriptors in a ring buffer (Ring Buffer).

[0047] 2. The host device sends the base address of the descriptor to the network card device through PCIe IO Write.

[0048] 3. When the network card device receives the data (Data) sent from the network side, it is first stored in the local storage space of the network card device.

[0049] 4. The network card device reads the descriptor to the host device through PCIe DMARead operation.

[0050] 5. The host device returns the corresponding descriptor through Read Response.

[0051] 6. The network card device writes the data existing in the local network card device into the memory of the host device through PCIe DMAWrite operation according to the address in the obtained descriptor.

[0052] 7. After the network card device writes the data, it notifies the host device that the data sending is completed through the interrupt MSI (Message signal interrupt, message signal interrupt).

[0053] 8. The host device reads the data in the corresponding memory after receiving the interrupt.

[0054] It can be determined through the above flow analysis that a plurality of PCIe interactions such as PCIe IO issuing, PCIe DMARead, PCIe DMAWrite, and PCIe event reporting are required to complete a data storage flow, but only the data is transferred from the network card device to the memory of the host device through DMAWrite, and other PCIe operations are only for synchronization information, and each PCIe interaction needs to be completed through transmission of a TLP (Transaction Layer Packet) message, which introduces a large delay and cannot meet the requirement of low delay of data storage. Therefore, the present specification provides a data access method, which can reduce the PCIe interaction between the host device and the network card device, thereby reducing the delay of data access. The specific implementation can be referred to the related description of each embodiment below.

[0055] In the present specification, a data access method is provided, and the present specification also relates to a data access device, a computing device, and a computer readable storage medium, which are described in detail one by one in the following embodiments.

[0056] Figure 2 A schematic diagram of a data access system provided by an embodiment of the present specification performing a data access method is shown. Referring to FIG. 1, Figure 2 The data access system 200 includes a host device 201 and a network card device 202, and the host device 201 and the network card device 202 communicate data through PCIe.

[0057] The host device 201 applies for a storage space from the memory and sends the storage space information to the network card device 202, the network card device 202 receives the storage space information sent by the host device 201, the storage space information includes a start address and a storage capacity of the storage space; according to a data length of the to-be-stored data, a data length of the stored data, and the storage capacity, it is identified whether the remaining storage capacity of the storage space meets the storage of the to-be-stored data; if not, the write number of the storage space is accumulated; based on the write number and the to-be-stored data, a data packet is constructed; the data packet is sent to the host device 201, the host device 201 receives the data packet of the to-be-stored data sent by the network card device 202, and in the case that the write number changes, the to-be-stored data is stored into the storage space based on the start address of the storage space.

[0058] Through the above method, the host device only needs to send the storage space information to the network card device once, and the network card device can cyclically write data into the storage space according to the storage space information, the data to be stored, and the data length of the stored data, and record the write times of the storage space. In the case that the remaining storage capacity of the storage space cannot store the data to be stored, the write times of the storage space are accumulated, and the write times and the data to be stored are sent to the host device, so that the host device stores the data to be stored based on the starting address in the case that the write times change. Not only the data interaction between the host device and the network card device is reduced, the time delay of data storage is reduced, and the efficiency of data storage is improved, but also the data to be stored is stored according to the write times, the data storage can be orderly performed, and the efficiency of data storage can be improved to a certain extent.

[0059] Figure 3 A flowchart of a data access method according to an embodiment of the present specification is shown, which is applied to a network card device and can specifically include the following steps:

[0060] Step 302: receiving storage space information applied by a host device from a memory, wherein the storage space information includes a starting address and a storage capacity of the storage space.

[0061] The storage capacity is the maximum data length of the storage space that can store data.

[0062] In the embodiments of the present specification, the host device applies a continuous storage space from the memory, which is used to store data to be stored from the network card device.

[0063] As an example, the host device is installed with software, and when the software is initialized, the host device applies a large continuous storage space from the memory and initializes it to 0 for storing received data.

[0064] In the embodiments of the present specification, the host device sends the starting address Base_addr and the storage capacity to the network card device through PCIe IOWrite. Since the storage space can be recycled, the host device only needs to send the storage space information once in the entire data access process, which can reduce the interaction between the host device and the network card device, reduce the PCIe interaction, and reduce the time delay.

[0065] Step 304: identifying whether the remaining storage capacity of the storage space meets the storage of the data to be stored according to the data length of the data to be stored, the data length of the stored data, and the storage capacity.

[0066] In the embodiments of the present disclosure, the network card device can first store the received to-be-stored data in the local storage space, and then determine whether the remaining storage capacity of the storage space is sufficient for storing the to-be-stored data, and then determine how to store the to-be-stored data in the storage space.

[0067] In a possible implementation of the present disclosure, the total data length can be determined according to the data length of the to-be-stored data and the data length of the stored data, and the total data length is compared with the storage capacity. If the total data length is greater than the storage capacity, it indicates that the remaining storage capacity of the storage space cannot meet the storage requirement of the to-be-stored data. If the total data length is less than the storage capacity, it indicates that the remaining storage capacity of the storage space can meet the storage requirement of the to-be-stored data.

[0068] In another possible implementation of the present disclosure, the specific implementation of identifying whether the remaining storage capacity of the storage space meets the storage requirement of the to-be-stored data according to the data length of the to-be-stored data, the data length of the stored data and the storage capacity can include:

[0069] According to the start address and the data length of the stored data, the storage address of the to-be-stored data in the storage space is determined. According to the start address, the storage address and the storage capacity, the remaining storage capacity of the storage space is determined. The data length of the to-be-stored data is compared with the remaining storage capacity. If the data length of the to-be-stored data is less than or equal to the remaining storage capacity, it is determined that the remaining storage capacity meets the storage requirement of the to-be-stored data. If the data length of the to-be-stored data is greater than the remaining storage capacity, it is determined that the remaining storage capacity does not meet the storage requirement of the to-be-stored data.

[0070] In a specific implementation, if data has been stored in the storage space before storing the to-be-stored data, the start address is added to the data length of the stored data to obtain the storage address of the to-be-stored data in the storage space. Then, according to the start address and the storage capacity, the end address of the storage space is determined. The capacity between the storage address and the end address is determined as the remaining storage capacity of the storage space. The remaining storage capacity is compared with the storage capacity of the to-be-stored data. If the data length of the to-be-stored data is less than or equal to the remaining storage capacity, it indicates that the remaining storage capacity of the storage space is sufficient for storing the to-be-stored data. If the data length of the to-be-stored data is greater than the remaining storage capacity, it indicates that the remaining storage capacity of the storage space is not sufficient for storing the to-be-stored data.

[0071] In the embodiments of the present disclosure, since the storage space is used in a loop, in the case that the remaining storage capacity of the storage space is not sufficient, the to-be-stored data cannot be continuously stored according to the determined storage address, and it is necessary to start from the start address for storage. Therefore, before storing the to-be-stored data, it is necessary to determine whether the remaining storage capacity is sufficient, so as to store the to-be-stored data in the correct storage address and avoid data storage errors.

[0072] Step 306: If no, then the write times of the storage space are accumulated.

[0073] In a specific implementation, if the remaining storage capacity cannot store the to-be-stored data, the to-be-stored data needs to be stored from the start address. Since the storage space has stored data, it indicates that the start address has stored data, and then the write times of the storage space are added by 1.

[0074] In the embodiments of the present disclosure, since the storage space is used in a loop, the same address can store different to-be-stored data at different times. For the to-be-stored data that cannot be stored in the remaining storage capacity, the to-be-stored data needs to be stored from the start address, and the write times of the storage space are added by 1. Thus, when the to-be-stored data is written, it can be determined that the to-be-stored data is stored when the storage space is written data for the first time, the data stored at the same address at different times can be distinguished, and when the data is read, it can be determined whether the data is the required data according to the write times, thereby avoiding errors in data reading.

[0075] Step 308: Based on the write times and the to-be-stored data, a data packet is constructed.

[0076] In the embodiments of the present disclosure, the data packet can be (Gen, Data), where Gen represents the write times, and Data represents the to-be-stored data.

[0077] Further, the data length of the to-be-stored data can also be added to the data packet, and the data packet (Len, Gen, Data) can be obtained, where Len represents the data length.

[0078] Step 310: The data packet is sent to the host device, so that the host device stores the to-be-stored data into the storage space based on the write times. In the case where the write times change, the host device stores the to-be-stored data into the storage space based on the start address.

[0079] In the embodiments of the present disclosure, the network card device can initiate the DMAWrite operation to send the data packet to the host device, the host device stores the to-be-stored data into the storage space based on the write times, and locally records the write times of the storage space. The host device can also update the locally recorded write times according to the write times in each received data packet.

[0080] It should be noted that the specific implementation of the host device storing the to-be-stored data into the storage space based on the write times can refer to the related description of steps 402-404 below.

[0081] Further, in the process of storing the to-be-stored data by the host device, the to-be-stored data can be stored continuously according to the occupied address of the stored data in the storage space, or the storage address of each to-be-stored data can be calculated by the network card device and sent to the host device together with the data packet, so that the host device can store the to-be-stored data according to the storage address.

[0082] Therefore, before the data packet is sent to the host device, the method further includes: determining the storage address of the to-be-stored data in the storage space according to the start address, the data length of the to-be-stored data, the data length of the stored data, and the storage capacity.

[0083] In this case, the sending of the data packet to the host device can include: sending the storage address of the to-be-stored data and the data packet to the host device, so that the host device stores the to-be-stored data into the storage space based on the write times and the storage address.

[0084] As an example, the sum of the data length of the stored data and the data length of the to-be-stored data can be determined to obtain a total data length, and the size of the total data length and the storage capacity is judged. If the total data length is greater than the storage capacity, it means that the remaining storage capacity of the storage space is not enough to store the to-be-stored data, and the storage address of the to-be-stored data is determined as the start address. If the total data length is less than or equal to the storage capacity, it means that the remaining storage capacity of the storage space is enough to store the to-be-stored data, and the storage address of the to-be-stored data can be determined according to the start address and the data length of the stored data.

[0085] As another example, the storage address of the to-be-stored data can be determined according to the start address and the data length of the stored data, the end address can be determined according to the start address and the storage capacity, the capacity between the storage address and the end address is determined as the remaining storage capacity, if the remaining storage capacity is greater than or equal to the data length of the to-be-stored data, the above-determined storage address is determined as the storage address of the to-be-stored data, if the remaining storage capacity is less than the data length of the to-be-stored data, the start address of the storage space is determined as the storage address of the to-be-stored data.

[0086] In the embodiments of the present specification, when the network card device calculates the storage address of each to-be-stored data and sends it to the host device, the host device can store the to-be-stored data based on the storage address, without the need to calculate the storage address, which not only reduces the computing pressure of the host device, but also improves the efficiency of data storage.

[0087] In the embodiments of the present specification, in the case that the to-be-stored data is the first to-be-stored data, the write times of the storage space are set to 0.

[0088] That is, if the to-be-stored data is the first data to be stored, it indicates that the storage space has not stored data, and therefore the to-be-stored data can be stored at the starting address, and the write count of the storage space is set to 0.

[0089] Further, the identification of whether the remaining storage capacity of the storage space meets the storage of the to-be-stored data after the storage of the to-be-stored data is further based on the data length of the to-be-stored data, the data length of the stored data, and the storage capacity.

[0090] If yes, the current write count of the storage space is kept unchanged;

[0091] Based on the write count and the to-be-stored data, a data packet is constructed.

[0092] The data packet is sent to the host device, so that the host device stores the to-be-stored data into the storage space based on the write count, and in the case that the write count is unchanged, the host device continuously stores the to-be-stored data in the storage space.

[0093] That is, if the remaining storage capacity of the storage space is sufficient to store the to-be-stored data, it is not necessary to store the to-be-stored data from the starting address, and the current write count of the storage space is kept unchanged, and in the case that the write count is unchanged, the host device can continuously store the to-be-stored data in the storage space.

[0094] The data access method provided by the embodiment of the present specification is applied to receive the storage space information applied for by the host device from the memory, wherein the storage space information comprises a start address and a storage capacity of the storage space; whether the remaining storage capacity of the storage space meets the storage of the to-be-stored data is identified according to the data length of the to-be-stored data, the data length of the stored data and the storage capacity; if not, the write times of the storage space are accumulated; the data packet is constructed based on the write times and the to-be-stored data; the data packet is sent to the host device, so that the host device stores the to-be-stored data into the storage space based on the write times, wherein in the case of the change of the write times, the host device stores the to-be-stored data into the storage space based on the start address. Through the above method, the host device only needs to send the storage space information to the network card device once, the network card device can cyclically write data into the storage space according to the storage space information, the to-be-stored data and the data length of the stored data, and record the write times of the storage space, and in the case that the remaining storage capacity of the storage space cannot store the to-be-stored data, the write times of the storage space are accumulated, the write times and the to-be-stored data are sent to the host device, so that the host device stores the to-be-stored data based on the start address in the case of the change of the write times, not only reducing the data interaction between the host device and the network card device, reducing the time delay of data storage, improving the efficiency of data storage, but also storing the to-be-stored data according to the write times, which can orderly store data and improve the efficiency of data storage to a certain extent.

[0095] Figure 4 A flow chart of another data access method provided by an embodiment of the present specification is shown, which is applied to a host device and can specifically include the following steps:

[0096] Step 402: receiving the data packet of the to-be-stored data sent by the network card device, wherein the data packet comprises the write times of the storage space and the to-be-stored data.

[0097] It should be noted that the data packet is constructed according to the above data access method applied to the network card device.

[0098] Step 404: in the case of determining the change of the write times, storing the to-be-stored data into the storage space based on the start address of the storage space.

[0099] In some embodiments, after the host device receives the data packet, the written times of the local recorded storage space are updated according to the written times in the data packet. Specifically, if the to-be-stored data is the first to-be-stored data, the written times in the data packet of the to-be-stored data is 0, and the written times of the local recorded storage space are recorded as 0. If the to-be-stored data is not the first to-be-stored data, whether to update the written times of the local recorded storage space is determined by judging whether the written times in the data packet of the to-be-stored data are the same as the written times of the local recorded storage space.

[0100] As an example, the specific implementation of determining that the written times change can include: judging whether the written times are the same as the written times of the local recorded storage space; and if not, determining that the written times change.

[0101] That is, in the case that the written times are different from the written times of the local recorded storage space, it is determined that the written times of the storage space change, and the to-be-stored data is written from the start address.

[0102] In the embodiments of the present specification, if the written times are different from the written times of the local recorded storage space, it indicates that in the process of calculating how the to-be-stored data is stored in the storage space by the network card device, the to-be-stored data cannot be stored in the remaining storage capacity of the storage space, and needs to be stored from the start address of the storage space, that is, a new round of storage of the storage space is entered. In this way, the written situation of the storage space can be synchronized between the network card device and the host device.

[0103] Further, after determining that the written times change, the written times of the local recorded storage space are further accumulated.

[0104] In the embodiments of the present specification, in the case of determining that the written times change, it indicates that the remaining storage capacity of the storage space is not enough to store the to-be-stored data, and the to-be-stored data is stored from the start address, that is, a new round of storage space reuse is started. Therefore, the written times of the local recorded storage space need to be increased by 1. In this way, the host device can monitor the written situation of the storage space in real time, avoid data storage confusion, and reduce the possibility of data storage problems.

[0105] In another case, after receiving the data packet of the to-be-stored data sent by the network card device, the to-be-stored data is continuously stored in the storage space, and the written times of the local recorded storage space remain unchanged in the case of determining that the written times do not change.

[0106] That is, if the written times in the data packet are the same as the locally stored written times, it indicates that the written times have not changed, and the remaining storage capacity of the storage space is sufficient to store the to-be-stored data. Therefore, the to-be-stored data can be continuously stored in the storage space, and the locally recorded written times can be kept unchanged, so that the host device can determine that the storage space is not currently subjected to a new round of writing data.

[0107] In some embodiments of the present specification, the continuously storing the to-be-stored data in the storage space comprises: determining a storage address of the to-be-stored data in the storage space based on the starting address and the data length of the stored data; and continuously storing the to-be-stored data in the storage space based on the storage address.

[0108] As an example, the storage address of the to-be-stored data in the storage space can be determined according to the storage condition of the storage space, and then the to-be-stored data can be stored according to the storage address.

[0109] For example, assuming that the starting address is Base_addr and the data length of the stored data is Len0, the storage address of the to-be-stored data can be determined as the address obtained by adding the data length Len0 of the stored data to the starting address Base_addr, and then the to-be-stored data is stored in the storage address.

[0110] As another example, the host device can record the storage address of each to-be-stored data after storing each to-be-stored data. When the next to-be-stored data needs to be stored, the storage address of the next to-be-stored data can be determined based on the storage address of the to-be-stored data and the data length of the to-be-stored data.

[0111] For example, when the first to-be-stored data needs to be stored, it is written to the address Addr of the storage space, which is the starting address Base_addr of the continuous space applied by the host device. The next to-be-stored data is written to the address Addr1 of the storage space, which is the starting address Base_addr plus the data length Len0 of the first to-be-stored data. The subsequent to-be-stored data is written to the address of the storage space, which is Addr1 plus the data length Len1 of the second to-be-stored data, and so on.

[0112] In some other embodiments of the present specification, the storage address of each to-be-stored data can be determined by the network card device, and the storage address and the data packet are delivered to the host device. Therefore, the host device does not need to make any calculation, and the to-be-stored data can be stored based on the storage address, which can improve the efficiency of data storage.

[0113] It is worth noting that when the to-be-stored data is stored in the storage space, the data packet can be stored in the storage space as a whole, so that whether the data is read or not can be determined according to the written times when the data is read subsequently.

[0114] In the embodiments of the present specification, after the host device receives the data packet of the to-be-stored data, whether the write times in the data packet and the locally stored write times are the same is determined, whether the write times change is determined, and in the case that the write times change, the to-be-stored data is stored based on the starting address, and the write times of the locally recorded storage space are increased by 1. In the case that the write times do not change, the to-be-stored data is continuously stored in the storage space, and the write times of the locally recorded storage space are kept unchanged. In this way, the write situation of the storage space of the network card device and the host device can be synchronized, and the write situation of the storage space recorded by the host device is real-time and accurate, and data storage confusion can be avoided.

[0115] It should be noted that the above description describes the process of writing the to-be-stored data into the storage space. In the present scheme, data storage and data reading are basically synchronized, that is, one piece of data is stored and one piece of data is read. Next, the process of reading the to-be-taken data from the storage space is introduced.

[0116] In some embodiments of the present specification, the specific implementation of the host device reading the to-be-taken data can include:

[0117] receiving a data reading instruction, wherein the data reading instruction is used to instruct the host device to read the to-be-taken data from the storage space, and the data reading instruction includes the starting address of the storage space and the data length of the taken data; determining the storage address of the to-be-taken data based on the starting address of the storage space and the data length of the taken data; in the case that data cannot be read based on the storage address, the locally recorded read times of the storage space are accumulated; and reading the to-be-taken data from the starting address based on the locally recorded read times.

[0118] In the specific implementation, in the case that the to-be-taken data needs to be read, the host device will receive a data reading instruction, and the starting address of the storage space and the data length of the taken data in the data reading instruction are added to obtain the data storage address of the to-be-taken data. However, the data length of some to-be-taken data can be relatively long, and the to-be-taken data cannot be completely stored based on the storage address, so the to-be-taken data needs to be stored based on the starting address. However, the data length of some to-be-taken data can not be very long, and the to-be-taken data can be completely stored based on the storage address, so the to-be-taken data is stored based on the storage address. Therefore, the to-be-taken data can not be obtained at the storage address. If data cannot be read based on the storage address, it indicates that the to-be-taken data is stored based on the starting address, so the data needs to be read based on the starting address, the locally recorded read times of the storage space are increased by 1, and the to-be-taken data is read from the starting address based on the locally recorded read times.

[0119] As an example, the host device can record the data length of each fetched data and the storage address of each fetched data locally, and can determine the storage address of the to-be-fetched data according to the storage address of the last fetched data and the data length of the last fetched data.

[0120] In the embodiments of the present specification, the host device can continuously read data from the applied storage space in a polling manner, and in order to avoid the read data being data that has been read, the data needs to be read according to the locally recorded read times, which can improve the accuracy of data reading and reduce the possibility of repeated data reading.

[0121] In some embodiments, the storage space also stores the write times in the data packet of the to-be-stored data, and the specific implementation of reading the to-be-fetched data from the start address based on the locally recorded read times can include: reading the write times from the start address; and if the read write times are the same as the locally recorded read times, reading the to-be-fetched data.

[0122] In the specific implementation, the data packet of the to-be-stored data can be stored to the storage space, and when the to-be-fetched data is read, the write times can be read. Since the write times can indicate the number of times the storage space is reused, and in the present scheme, data reading and data storage are basically synchronized, the read times of the storage space recorded locally and the write times in the data packet are usually the same. However, if data reading and data storage are not synchronized, when the data is read, the read data can be the data that has been read or the data can be missed in a round of reading. Therefore, when the to-be-fetched data is read, whether to read the to-be-fetched data needs to be determined according to the read write times and the locally recorded read times.

[0123] As an example, the write times can be read from the start address, and if the read write times are the same as the locally recorded read times, it indicates that the data access is relatively synchronized, the to-be-fetched data stored at the start address is the data stored in the current round and has not been read. Therefore, the to-be-fetched data can be read.

[0124] In the embodiments of the present specification, whether to read the to-be-fetched data is determined according to whether the write times and the read times are the same, which can improve the accuracy of data reading.

[0125] Further, after reading the write times from the start address, the method further includes: if the read write times are different from the locally recorded read times, discarding the data at the start address.

[0126] That is, if the read write times are different from the locally recorded write times, it indicates that the data currently stored at the start address is the fetched data stored in the last round and has been read, and therefore, the data at the start address does not need to be read again. Therefore, the data at the start address can be discarded.

[0127] It should be noted that the above description is based on the starting address reading data in the case of unable to read data based on the storage address, and the following introduces the specific implementation of reading data in the case of being able to read data based on the storage address.

[0128] Therefore, after determining the storage address of the to-be-read data based on the starting address of the storage space and the data length of the read data, the method further includes: in the case of being able to read data based on the storage address, keeping the read times of the storage space recorded locally unchanged; and reading the to-be-read data from the storage address based on the read times recorded locally.

[0129] In the specific implementation, if data can be read based on the storage address, it indicates that the to-be-read data is indeed stored at the storage address, and there is no need to read data from the starting address, so the read times of the storage space recorded locally are kept unchanged, and the write times are read from the storage address, if the read write times are the same as the write times recorded locally, the to-be-read data is continuously read, and if the read write times are different from the write times recorded locally, the data at the storage address is discarded.

[0130] By applying the data access method provided in the embodiments of the present specification, the host device only needs to send the storage space information to the network card device once, and the network card device can cyclically write data into the storage space according to the storage space information, the to-be-stored data and the data length of the stored data, and record the write times of the storage space, and in the case that the remaining storage capacity of the storage space cannot store the to-be-stored data, the write times of the storage space are accumulated, and the write times and the to-be-stored data are sent to the host device. The host device determines whether the write times change according to the write times of the storage space recorded locally and the write times in the data packet, and in the case that the write times change, stores the to-be-stored data based on the starting address, and in the case that the write times do not change, continuously stores the to-be-stored data. Not only reduces the data interaction between the host device and the network card device, reduces the time delay of data storage, improves the efficiency of data storage, but also stores the to-be-stored data according to the write times, can orderly perform data storage, and can also improve the efficiency of data storage to a certain extent. In addition, the host device reads data from the storage space in a polling manner, and determines whether to continue reading data according to whether the read write times are the same as the read times recorded locally, which can improve the accuracy of data reading.

[0131] The following describes the data access method provided in the embodiments of the present specification in combination with the accompanying Figure 5 The data access method provided in the embodiments of the present specification is further described by taking the application of the data access method in the financial field as an example. Among them, Figure 5 FIG. 1 shows a processing flowchart of a data access method applied to the financial communication field according to an embodiment of the present specification, which specifically includes the following steps:

[0132] Step 502: The host device applies for a large block of continuous storage space from the memory.

[0133] Step 504: The host device sends the start address Base_addr and the storage capacity of the applied storage space to the network card device through PCIe IO Write.

[0134] Step 506: The network card device receives the data to be stored, and determines the storage address of the data to be stored in the storage space according to the start address and the data length of the stored data.

[0135] Step 508: The remaining storage capacity of the storage space is determined according to the start address, the storage address and the storage capacity.

[0136] Step 510: The data length of the data to be stored is compared with the remaining storage capacity to identify whether the remaining storage capacity is sufficient to store the data to be stored.

[0137] If not, step 512 is executed; if yes, step 514 is executed.

[0138] Step 512: The number of times of writing of the storage space is accumulated.

[0139] Step 514: The current number of times of writing of the storage space is kept unchanged.

[0140] Step 516: A data packet is constructed based on the number of times of writing and the data to be stored, and the data packet is sent to the host device.

[0141] Step 518: The host device judges whether the number of times of writing in the data packet is the same as the number of times of writing of the storage space recorded locally.

[0142] If not, step 520 is executed; if yes, step 522 is executed.

[0143] Step 520: It is determined that the number of times of writing changes, the data to be stored is stored in the storage space based on the start address of the storage space, and the number of times of writing of the storage space recorded this time is increased by 1.

[0144] Step 522: It is determined that the number of times of writing does not change, the data to be stored is continuously stored in the storage space, and the number of times of writing of the storage space recorded locally is kept unchanged.

[0145] Step 524: A data reading instruction is received, wherein the data reading instruction is used to instruct the host device to read the data to be taken from the storage space, and the data reading instruction includes the start address of the storage space and the data length of the taken data.

[0146] Step 526: The storage address of the data to be taken is determined based on the start address of the storage space and the data length of the taken data.

[0147] Step 528: in the case that data cannot be read based on the storage address, the read times of the local recorded storage space are accumulated.

[0148] Step 530: read the write times from the starting address, if the read write times are the same as the local recorded read times, read the data to be taken.

[0149] If the read write times are different from the local recorded read times, discard the data at the starting address.

[0150] Step 532: in the case that data is read based on the storage address, keep the read times of the local recorded storage space unchanged, read the data to be taken from the storage address based on the local recorded read times.

[0151] The data access method provided in the specification, the host device only needs to send storage space information to the network card device once, the network card device can write data into the storage space according to the storage space information, the data length of the data to be stored and the stored data, and record the write times of the storage space, and in the case that the remaining storage capacity of the storage space cannot store the data to be stored, the write times of the storage space are accumulated, the write times and the data to be stored are sent to the host device, the host device determines whether the write times change according to the local recorded write times of the storage space and the write times in the data packet, and in the case that the write times change, stores the data to be stored based on the starting address, and in the case that the write times do not change, stores the data to be stored continuously, not only reduces the data interaction between the host device and the network card device, reduces the time delay of data storage, improves the efficiency of data storage, but also stores the data to be stored according to the write times, can orderly store data, and can improve the efficiency of data storage to a certain extent. In addition, the host device reads data from the storage space in a polling manner, and determines whether to continue reading data according to whether the read write times are the same as the local recorded read times, which can improve the accuracy of data reading.

[0152] Referring to Figure 6 , Figure 6 A schematic diagram of data access provided by an embodiment of the specification is shown.

[0153] The host device applies a large block of continuous storage space (buf) from the memory, and sends the start address Base_addr and storage capacity of the applied storage space to the network card device through PCIe IO Write. The network card device adds a description field (length of data, memory cycle number starting from 0) with a fixed value Head_len in the data header according to the data to be sent. When the first data packet needs to be sent, the address Addr0 written to the memory is the start address Base_addr of the continuous space applied by the host device. The address Addr1 of the next data packet written to the memory is Base_addr plus the length Len0 of the first data packet, and the address of the following data packet written to the memory is Addr1 plus the length Len1 of the second packet, and so on. When the applied memory space is full, the data is written from Base_addr again, only Gen is increased by one, thereby notifying the host device the number of times the storage space is written. For example, the first data packet, the second data packet and the third data packet are stored continuously in the applied space, and the memory space is not full when the third data packet is stored, so the write number recorded in the storage space when the third data packet is stored is still Gen0. Therefore, the storage of the data packet in the memory of the host device is Len0, Gen0, Data0, Len1, Gen0, Data1, Len2, Gen0, Data2.

[0154] The network card device initiates a DMAWrite operation according to the total length of the newly constructed data packet Pkt (including Len, Gen, Data) and the address Addr written to the memory, and writes the data to be stored from the network card device to the continuous storage space applied by the host device through the DMAWrite operation. For example, the data packet constructed in the network card device includes: data packet Pkt0 (Len0, Gen0, Data0), data packet Pkt1 (Len1, Gen0, Data1), data packet Pkt2 (Len2, Gen0, Data2), and so on.

[0155] The software installed on the host device continuously reads data from the continuous memory space applied for in a polling manner and records the read times of the memory space Gen. Data is read from the start address of the memory space, and when the first packet data header field Len0 and Gen0 field are read, whether the locally recorded Gen and the read Gen0 are equal is compared. If they are equal, the first data Data0 is read according to the length Len0, and if they are not equal, the first data is discarded. After the data is read, the start address of the next data reading is the initial address of the continuous memory plus the length of the first packet (the fixed header length and Len0). If the memory address of the next packet exceeds the applied memory length, the reading is restarted from the start address, and the locally recorded read times Gen of the memory space is added by 1. The new start address is continuously read until Len1 and Gen1 are read, and whether the read Gen1 and the locally recorded Gen are equal is compared. If they are equal, the previous process is repeated to complete the continuous reading of the data.

[0156] Corresponding to the method embodiments applied to the network card device, the present specification also provides data access device embodiments, Figure 7 A structure schematic diagram of a data access device provided by an embodiment of the present specification is shown. As shown in the figure, Figure 7 The device comprises:

[0157] A first receiving module 702 configured to receive memory space information applied for by a host device from a memory, wherein the memory space information comprises a start address and a storage capacity of the memory space;

[0158] An identifying module 704 configured to identify whether a remaining storage capacity of the memory space meets storage of to-be-stored data according to a data length of the to-be-stored data, a data length of stored data and the storage capacity;

[0159] A times accumulating module 706 configured to accumulate a written times of the memory space if not;

[0160] A constructing module 708 configured to construct a data packet based on the written times and the to-be-stored data;

[0161] A sending module 710 configured to send the data packet to the host device, so that the host device stores the to-be-stored data into the memory space based on the written times, wherein in the case that the written times changes, the host device stores the to-be-stored data into the memory space based on the start address.

[0162] Optionally, the device further comprises a times invariable module configured to:

[0163] If yes, keep the current written times of the memory space unchanged;

[0164] construct a data packet based on the written times and the data to be stored;

[0165] send the data packet to the host device, so that the host device stores the data to be stored in the storage space based on the written times, wherein, in the case that the written times are unchanged, the host device continuously stores the data to be stored in the storage space.

[0166] Optionally, in the case that the data to be stored is the first data to be stored, the written times of the storage space are set to 0.

[0167] Optionally, the identification module 704 is configured to:

[0168] determine a storage address of the data to be stored in the storage space according to the start address and a data length of the stored data;

[0169] determine a remaining storage capacity of the storage space according to the start address, the storage address and the storage capacity;

[0170] compare the data length of the data to be stored with the remaining storage capacity;

[0171] if the data length of the data to be stored is less than or equal to the remaining storage capacity, determine that the remaining storage capacity meets the storage of the data to be stored;

[0172] if the data length of the data to be stored is greater than the remaining storage capacity, determine that the remaining storage capacity does not meet the storage of the data to be stored.

[0173] Optionally, the sending module 710 is configured to:

[0174] determine a storage address of the data to be stored in the storage space according to the start address, the data length of the data to be stored, the data length of the stored data and the storage capacity;

[0175] send the storage address of the data to be stored and the data packet to the host device, so that the host device stores the data to be stored in the storage space based on the written times and the storage address.

[0176] The application embodiment provided by the specification provides a data access device applied to a network card device. A host device only needs to send storage space information to the network card device once. The network card device can cyclically write data into a storage space according to the storage space information, to-be-stored data and data lengths of stored data, and record the written times of the storage space. In the case that the remaining storage capacity of the storage space cannot store the to-be-stored data, the written times of the storage space are accumulated, and the written times and the to-be-stored data are sent to the host device. The host device stores the to-be-stored data based on a starting address in the case that the written times change. This not only reduces the data interaction between the host device and the network card device, reduces the time delay of data storage and improves the efficiency of data storage, but also stores the to-be-stored data according to the written times, can orderly perform data storage and can improve the efficiency of data storage to a certain extent.

[0177] The above is a schematic scheme of the data access device of the embodiment. It should be noted that the technical scheme of the data access device belongs to the same concept as the technical scheme of the data access method applied to the network card device. The details of the technical scheme of the data access device that are not described in detail can be referred to the description of the technical scheme of the data access method applied to the network card device.

[0178] Corresponding to the method embodiment applied to the host device, the specification also provides a data access device embodiment, Figure 8 The structure schematic diagram of another data access device provided by an embodiment of the specification is shown. As shown in the figure, Figure 8 The device comprises:

[0179] The second receiving module 802 is configured to receive a data packet of to-be-stored data sent by a network card device, wherein the data packet comprises written times of a storage space and the to-be-stored data.

[0180] The data storage module 804 is configured to store the to-be-stored data into the storage space based on a starting address of the storage space in the case that the written times change.

[0181] Optionally, the data storage module 804 is further configured to:

[0182] In the case that the written times do not change, the to-be-stored data is continuously stored into the storage space, and the written times of the storage space recorded locally remain unchanged.

[0183] Optionally, the data storage module 804 is further configured to:

[0184] Determine a storage address of the to-be-stored data in the storage space based on the starting address and the data length of the stored data.

[0185] based on the storage address, continuously storing the data to be stored into the storage space.

[0186] Optionally, the apparatus further comprises a judging module configured to:

[0187] judge whether the written times are same as the locally recorded written times of the storage space;

[0188] if not, determine that the written times change.

[0189] Optionally, the judging module is further configured to:

[0190] accumulate the locally recorded written times of the storage space.

[0191] Optionally, the apparatus further comprises a data reading module configured to:

[0192] receive a data reading instruction, wherein the data reading instruction is used to instruct a host device to read data to be read from the storage space, and the data reading instruction comprises a start address of the storage space and a data length of data read;

[0193] based on the start address of the storage space and the data length of data read, determine a storage address of the data to be read;

[0194] in a case where data cannot be read based on the storage address, accumulate locally recorded read times of the storage space;

[0195] read the data to be read from the start address based on the locally recorded read times.

[0196] Optionally, the storage space further stores written times in a data packet of the data to be stored, and reading the data to be read from the start address based on the locally recorded read times comprises:

[0197] reading the written times from the start address;

[0198] if the read written times are same as the locally recorded read times, reading the data to be read.

[0199] Optionally, the data reading module is further configured to:

[0200] in a case where data can be read based on the storage address, keeping the locally recorded read times of the storage space unchanged;

[0201] reading the data to be read from the storage address based on the locally recorded read times.

[0202] Optionally, the data reading module is further configured to:

[0203] If the read write times are different from the locally recorded read times, discard the data at the start address.

[0204] The data access device provided by the embodiment of the present specification is applied to a host device. The host device only needs to send storage space information to a network card device once. The network card device can cyclically write data into the storage space according to the storage space information, the data to be stored and the data length of the stored data, and record the write times of the storage space. In the case that the remaining storage capacity of the storage space cannot store the data to be stored, the write times of the storage space are accumulated, and the write times and the data to be stored are sent to the host device. The host device determines whether the write times change according to the locally recorded write times of the storage space and the write times in the data packet. In the case that the write times change, the data to be stored is stored based on the start address. In the case that the write times do not change, the data to be stored is continuously stored. Not only is the data interaction between the host device and the network card device reduced, the time delay of data storage is reduced, and the efficiency of data storage is improved, but also the data to be stored is stored according to the write times, the data storage can be orderly performed, and the efficiency of data storage can be improved to a certain extent. In addition, the host device reads data from the storage space in a polling manner, and determines whether to continue reading data according to whether the read write times are the same as the locally recorded read times. The accuracy of data reading can be improved.

[0205] The above is a schematic scheme of the data access device of the embodiment. It should be noted that the technical scheme of the data access device belongs to the same concept as the technical scheme of the data access method applied to the host device. The details of the technical scheme of the data access device that are not described in detail can be referred to the description of the technical scheme of the data access method applied to the host device.

[0206] Figure 9 A structural block diagram of a computing device 900 is shown according to an embodiment of the present specification. The components of the computing device 900 include but are not limited to a memory 910 and a processor 920. The processor 920 is connected with the memory 910 through a bus 930, and a database 950 is used to save data.

[0207] The computing device 900 also includes an access device 940 that enables the computing device 900 to communicate via one or more networks 960. Examples of such networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or combinations of such networks, such as the Internet. The access device 940 can include one or more of any type of network interface (for example, a network interface card (NIC)), such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, or the like.

[0208] In one embodiment of the present specification, the above-mentioned components of the computing device 900 and other components not shown in the Figure 9 may be connected to each other, such as through a bus. It should be understood that Figure 9 The computing device structure diagram shown is only for the purpose of example, and is not a limitation on the scope of the present specification. Those skilled in the art can add or replace other components as needed.

[0209] The computing device 900 can be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (for example, a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, and the like), a mobile phone (for example, a smartphone), a wearable computing device (for example, a smart watch, smart glasses, and the like), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 900 can also be a mobile or stationary server.

[0210] The processor 920 is configured to execute computer-executable instructions to implement the data access method provided in the present specification.

[0211] The above is a schematic scheme of the computing device of the embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the data access method described above belong to the same concept, and the details of the technical scheme of the computing device that are not described in detail can be referred to the description of the technical scheme of the data access method.

[0212] An embodiment of the present specification also provides a computer readable storage medium storing computer instructions, which, when executed by a processor, implements the steps of the data access method provided by the present specification.

[0213] The above is a schematic scheme of the computer readable storage medium of the embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the data access method described above belong to the same concept, and the details of the technical scheme of the storage medium that are not described in detail can be referred to the description of the technical scheme of the data access method.

[0214] The above describes specific embodiments of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the acts or steps recited in the claims can be performed in a different order than the order in which they are recited and still achieve desirable results. In addition, the processes depicted in the figures do not necessarily require the particular order shown, or sequential order to achieve the desired results. In certain implementations, multitasking and parallel processing can be advantageous.

[0215] The computer instructions include computer program code, which can be in the form of source code, object code, executable code, or some intermediate form. The computer readable medium can include any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc.

[0216] It should be noted that for each of the above method embodiments, in order to facilitate description, they are all expressed as a combination of a series of acts, but those skilled in the art should know that the present specification is not limited by the order of the described acts, because according to the present specification, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the acts and modules involved are not necessarily essential to the present specification.

[0217] In the above-described embodiments, the description of each embodiment focuses on different aspects, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.

[0218] The preferred embodiments of the present specification disclosed above are only used to help explain the present specification. The alternative embodiments do not describe all the details and limit the present application to the specific embodiments described. Obviously, many modifications and variations can be made according to the content of the present specification. The present specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present specification, so that those skilled in the art can well understand and utilize the present specification. The present specification is limited only by the claims and their full scope and equivalents.

Claims

1. A data access method, characterized by, The application is applied to a network card device, and comprises: receiving storage space information applied by a host device from a memory, wherein the storage space information comprises a start address and a storage capacity of the storage space; identifying whether a remaining storage capacity of the storage space meets storage of the to-be-stored data according to a data length of the to-be-stored data, a data length of stored data and the storage capacity; if not, accumulating a written number of times of the storage space, wherein the written number of times is used to determine when the to-be-stored data is stored in the storage space when the to-be-stored data is written; constructing a data packet based on the written number of times and the to-be-stored data; sending the data packet to the host device, so that the host device stores the to-be-stored data into the storage space based on the written number of times, wherein in the case that the written number of times changes, the host device stores the to-be-stored data into the storage space based on the start address.

2. The method of claim 1, wherein, After the step of identifying whether the remaining storage capacity of the storage space meets storage of the to-be-stored data according to the data length of the to-be-stored data, the data length of the stored data and the storage capacity, the method further comprises: if yes, keeping the current written number of times of the storage space unchanged; constructing a data packet based on the written number of times and the to-be-stored data; sending the data packet to the host device, so that the host device stores the to-be-stored data into the storage space based on the written number of times, wherein in the case that the written number of times is unchanged, the host device continuously stores the to-be-stored data in the storage space.

3. The method according to claim 1 or 2, characterized in that, The step of identifying whether the remaining storage capacity of the storage space meets storage of the to-be-stored data according to the data length of the to-be-stored data, the data length of the stored data and the storage capacity comprises: determining a storage address of the to-be-stored data in the storage space according to the start address and the data length of the stored data; determining the remaining storage capacity of the storage space according to the start address, the storage address and the storage capacity; comparing the data length of the to-be-stored data with the remaining storage capacity; if the data length of the to-be-stored data is less than or equal to the remaining storage capacity, determining that the remaining storage capacity meets storage of the to-be-stored data; if the data length of the to-be-stored data is greater than the remaining storage capacity, determining that the remaining storage capacity does not meet storage of the to-be-stored data.

4. The method according to claim 1 or 2, characterized in that, Before the step of sending the data packet to the host device, the method further comprises: determining a storage address of the to-be-stored data in the storage space according to the start address, the data length of the to-be-stored data, the data length of the stored data and the storage capacity; The step of sending the data packet to the host device comprises: sending the storage address of the to-be-stored data and the data packet to the host device, so that the host device stores the to-be-stored data into the storage space based on the written number of times and the storage address.

5. A data access method, characterized by, The application is applied to a host device, and comprises: receiving a data packet of to-be-stored data sent by a network card device, wherein the data packet comprises a written number of times of a storage space and the to-be-stored data; In a case where the written number of times is determined to change, the data to be stored is stored in the storage space based on a start address of the storage space, wherein the written number of times is used to determine when the data to be stored is stored in the storage space when the data to be stored is written.

6. The method of claim 5, wherein, After the data packet of the data to be stored is received by the network card device, the method further comprises: In a case where the written number of times is determined to be unchanged, the data to be stored is continuously stored in the storage space, and the locally recorded written number of times of the storage space is kept unchanged.

7. The method of claim 6, wherein, The continuously storing the data to be stored in the storage space comprises: determining a storage address of the data to be stored in the storage space based on the start address and the data length of the stored data; continuously storing the data to be stored in the storage space based on the storage address.

8. The method of claim 5, wherein, The determining the written number of times to change comprises: determining whether the written number of times is the same as the locally recorded written number of times of the storage space; if not, determining that the written number of times changes.

9. The method according to claim 5 or 8, characterized in that, After the determining the written number of times to change, the method further comprises: accumulating the locally recorded written number of times of the storage space.

10. The method of claim 5, wherein, The method further comprises: receiving a data reading instruction, wherein the data reading instruction is used to instruct the host device to read data to be read from the storage space, and the data reading instruction comprises a start address of the storage space and a data length of the read data; determining a storage address of the data to be read based on the start address of the storage space and the data length of the read data; in a case where data cannot be read based on the storage address, accumulating a locally recorded read number of times of the storage space; reading the data to be read from the start address based on the locally recorded read number of times.

11. The method of claim 10, wherein, The storage space further stores a written number of times in the data packet of the data to be stored, and the reading the data to be read from the start address based on the locally recorded read number of times comprises: reading the written number of times from the start address; if the read written number of times is the same as the locally recorded read number of times, reading the data to be read.

12. The method of claim 10, wherein, After the determining the storage address of the data to be read based on the start address of the storage space and the data length of the read data, the method further comprises: in a case where data is read based on the storage address, keeping the locally recorded read number of times of the storage space unchanged; reading the data to be read from the storage address based on the locally recorded read number of times.

13. The method of claim 11, wherein, After the reading the written number of times from the start address, the method further comprises: if the read written number of times is different from the locally recorded read number of times, discarding the data at the start address.

14. A data access device, characterized by The application is applied to a network card device, and comprises: a first receiving module configured to receive storage space information applied by a host device from a memory, wherein the storage space information comprises a start address and a storage capacity of a storage space; a recognition module configured to recognize whether a remaining storage capacity of the storage space meets a requirement of storing data to be stored according to a data length of the data to be stored, a data length of stored data, and the storage capacity. a number accumulation module configured to accumulate a written number of the storage space if the result is negative, wherein the written number is used to determine when the to-be-stored data is stored when the to-be-stored data is written into the storage space; a construction module configured to construct a data packet based on the written number and the to-be-stored data; a sending module configured to send the data packet to the host device, so that the host device stores the to-be-stored data into the storage space based on the written number, wherein, in a case where the written number changes, the host device stores the to-be-stored data into the storage space based on the start address.

15. A data access device, characterized by application to a network card device, comprising: a second receiving module configured to receive a data packet of to-be-stored data sent by a network card device, wherein the data packet comprises a written number of a storage space and the to-be-stored data; a data storage module configured to, in a case where it is determined that the written number changes, store the to-be-stored data into the storage space based on a start address of the storage space, wherein the written number is used to determine when the to-be-stored data is stored when the to-be-stored data is written into the storage space.

16. A computing device, comprising: a memory and a processor; the memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions to implement the data access method for the network card device in any one of claims 1-4, or implement the data access method for the host device in any one of claims 5-13.

17. A computer readable storage medium, which stores computer instructions, and the instructions are executed by a processor to implement the steps of the data access method for the network card device in any one of claims 1-4, or implement the steps of the data access method for the host device in any one of claims 5-13.

Citation Information

Patent Citations

  • Method for erasing and writing data of FLASH memory

    CN102306125A