WO2021042782A1 - Network card information processing method and chip - Google Patents

Network card information processing method and chip Download PDF

Info

Publication number
WO2021042782A1
WO2021042782A1 PCT/CN2020/094031 CN2020094031W WO2021042782A1 WO 2021042782 A1 WO2021042782 A1 WO 2021042782A1 CN 2020094031 W CN2020094031 W CN 2020094031W WO 2021042782 A1 WO2021042782 A1 WO 2021042782A1
Authority
WO
WIPO (PCT)
Prior art keywords
queue
information
queue information
network card
frequency
Prior art date
Application number
PCT/CN2020/094031
Other languages
French (fr)
Chinese (zh)
Inventor
胡天驰
林伟彬
侯新宇
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2021042782A1 publication Critical patent/WO2021042782A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0844Multiple simultaneous or quasi-simultaneous cache accessing
    • G06F12/0853Cache with multiport tag or data arrays
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F15/00Digital computers in general; Data processing equipment in general
    • G06F15/16Combinations of two or more digital computers each having at least an arithmetic unit, a program unit and a register, e.g. for a simultaneous processing of several programs

Definitions

  • the present application relates to the field of servers, and more specifically, to an information processing method of a network card and a chip for information processing of the network card.
  • RDMA remote direct memory access
  • the network card can obtain queue information (for example, the queue pair context (QPC)) to process the IO commands to be processed.
  • queue information is stored in the memory of the server.
  • QPC queue pair context
  • part of the queue information can be buffered in the buffer space of the network card. Due to the small scale of the cache space in the network card, it is necessary to update the queue information cached in the cache space of the network card. How to improve the hit rate of the cache space of the network card and reduce the frequent read and write of the queue information stored in the memory due to the network card through the bus The resulting delay and the waste of bus bandwidth have become problems that need to be resolved urgently.
  • the present application provides an information processing method and chip for a network card, which can improve the hit rate of the cache space.
  • an information processing method for a network card is provided.
  • the local server and the remote server perform data transmission through remote direct memory access RDMA.
  • the memory of the local server stores at least one queue, and each queue is used for storage.
  • the IO command instructs the local server to access data to the remote server.
  • the method includes: the network card predicts high-frequency queue information, and the high-frequency queue information is more likely to be accessed than other queue information; the network card is in the cache space
  • the high-frequency queue information is stored in the network card, where the buffer space is in the network card, the queue information stored in the buffer space corresponds to the queue in the memory of the local server, and each queue information is used for the network card to correspond to the queue information IO commands in the queue are processed.
  • the high-frequency queue information can be predicted, and the high-frequency queue information can be stored in the cache space of the network card, thereby improving the hit rate of the cache space of the network card, and further reducing the bus read and write access generated by the network card Reduce the waste of bus bandwidth, reduce the processing delay of the IO commands to be processed by the network card, and improve the transmission performance of the server.
  • the network card predicting the high-frequency queue information specifically includes: the network card searches the queue information currently being read in the queue information cached in the buffer space, and replaces the currently read queue information Determined as high-frequency queue information.
  • the queue information in the buffer space since the read and write access to the queue information in the buffer space occurs in pairs, if a read request is received for a certain queue information, then the queue information is more likely to be accessed in a short period of time.
  • the currently read queue information is determined to be high-frequency queue information, which can improve the hit rate of the cache space.
  • the network card predicts the high-frequency queue information specifically including: the queue information is the queue pair context QPC, and the network card calculates the difference between the read pointer and the write pointer in the QPC cached in the cache space, The QPC with the difference between the read pointer and the write pointer greater than the preset threshold is determined as the high-frequency queue information.
  • the number of IO commands to be processed in the queue corresponding to the QPC can be determined according to the difference between the read pointer and the write pointer in the QPC, so as to determine the number of IO commands to be processed subsequently to be accessed by the QPC. Possibility to improve the hit rate of the cache space.
  • the network card predicting high-frequency queue information specifically includes: the network card obtains the IO command scheduling sequence, the IO command scheduling sequence records the pending IO commands; the network card determines the pending IO commands according to the IO command scheduling sequence The queue information corresponding to the queue to which the processed IO command belongs, and the queue information corresponding to the queue to which the IO command to be processed belongs is determined as high frequency queue information.
  • the unprocessed IO command can be pre-read first, and the queue information required to process the IO command is determined according to the queue information to which the unprocessed IO command belongs.
  • the queue information is more likely to be accessed later.
  • the queue information can be determined as high-frequency queue information, thereby improving the hit rate of the cache space.
  • the network card in this application can also predict high-frequency queue information according to any two or three prediction methods described above, and store the predicted high-frequency queue information in the cache space of the network card.
  • the network card predicting the high-frequency queue information specifically includes: the network card searches the queue information currently being read in the queue information cached in the buffer space, and replaces the currently read queue information When it is determined to be the high-frequency queue information, and, when the queue information is the queue pair context QPC, the network card calculates the difference between the read pointer and the write pointer in the QPC cached in the cache space, and the difference between the read pointer and the write pointer is greater than the preset threshold The QPC is determined as the high-frequency queue information.
  • the network card predicting the high-frequency queue information specifically includes: the network card searches the queue information currently being read in the queue information cached in the buffer space, and replaces the currently read queue information Determined as the high-frequency queue information, and, the network card obtains the IO command scheduling sequence.
  • the IO command scheduling sequence records the IO commands to be processed; the network card determines the queue information corresponding to the queue to which the IO commands to be processed belongs according to the IO command scheduling sequence.
  • the queue information corresponding to the queue to which the processed IO command belongs is determined to be high-frequency queue information.
  • the network card predicts the high-frequency queue information specifically including: the queue information is the queue pair context QPC, and the network card calculates the difference between the read pointer and the write pointer in the QPC cached in the cache space, The QPC where the difference between the read pointer and the write pointer is greater than the preset threshold is determined as high-frequency queue information, and the network card obtains the IO command scheduling sequence.
  • the IO command scheduling sequence records the pending IO commands; the network card determines the IO command scheduling sequence
  • the queue information corresponding to the queue to which the to-be-processed IO command belongs, and the queue information corresponding to the queue to which the to-be-processed IO command belongs is determined as high-frequency queue information.
  • the network card predicts the high-frequency queue information specifically including: the queue information is the queue pair context QPC, and the network card calculates the difference between the read pointer and the write pointer in the QPC cached in the cache space, The QPC where the difference between the read pointer and the write pointer is greater than the preset threshold is determined as high-frequency queue information, and the network card obtains the IO command scheduling sequence.
  • the IO command scheduling sequence records the pending IO commands; the network card determines the IO command scheduling sequence
  • the queue information corresponding to the queue to which the pending IO command belongs, the queue information corresponding to the queue to which the pending IO command belongs is determined as high-frequency queue information, and the network card searches the queue information cached in the buffer space for the current read The queue information of, determines the queue information currently being read as high-frequency queue information.
  • the network card reads the high-frequency queue information from the memory; and saves the high-frequency queue information in the buffer space.
  • the high-frequency queue information determined by the network card can be obtained from the memory and stored in the cache space of the network card, avoiding the large processing delay caused by obtaining the required queue information from the memory when processing IO commands. .
  • the network card determines that the high-frequency queue information has been stored in the cache space; the network card sets the state information of the high-frequency queue information in the cache space, so The status information is used to indicate that the high-frequency queue information continues to be stored in the buffer space.
  • the status information includes priority information or lock information, where the priority information is used to indicate the priority of the high-frequency queue information being updated in the buffer space.
  • the locking information is used to indicate that the high-frequency queue information is in a non-updated locked state in the buffer space.
  • the priority information or the lock information may be represented by a status flag bit.
  • the status flag bit of the queue information is set, which indicates that the queue information is in a locked state that is not updated temporarily in the buffer space.
  • the priority information of the queue information is represented by multiple status flag bits, and each status flag bit is used to indicate the result obtained by a method of predicting high-frequency queue information.
  • a method of predicting high-frequency queue information is used to predict a queue information.
  • the more the status flag bits corresponding to the queue information are set the lower the priority of the queue information being updated in the buffer space.
  • the queue information includes one or more of the following information: queue pair context QPC, completion queue context CQC, and event queue context EQC.
  • the method further includes: the network card may also update or replace part or all of the queue information stored in the buffer space.
  • the method further includes: the network card may also update or replace part or all of the queue information stored in the buffer space according to the priority information or the lock information.
  • the network card divides the queue information in the cache space into levels according to the state information in the cache space, wherein the queue information with a higher level may be accessed The higher the performance, the priority is to update the low-level queue information stored in the buffer space.
  • a chip is provided, the chip is applied to a server system, the local server and the remote server in the server system perform data transmission through remote direct memory access RDMA, and the memory of the local server At least one queue is stored, and each queue is used to store input and output IO commands.
  • the IO commands instruct the local server to access data to the remote server, and the chip includes:
  • the processing unit is configured to store the high-frequency queue information in a cache space, wherein the cache space is in the network card of the local server, and the queue information stored in the cache space is one-to-one with the queue in the memory Correspondingly, each queue information is used by the network card to process the IO commands in the queue corresponding to the queue information.
  • the processing unit is further configured to: update or replace part or all of the queue information stored in the buffer space.
  • the prediction unit is specifically configured to: search for the currently read queue information in the queue information cached in the buffer space, and compare the currently read queue information The queue information is determined to be the high-frequency queue information.
  • the queue information is the queue pair context QPC
  • the prediction unit is specifically configured to: calculate the difference between the read pointer and the write pointer in the QPC buffered in the buffer space Value, the QPC whose difference between the read pointer and the write pointer is greater than a preset threshold is determined as the high-frequency queue information.
  • the prediction unit is specifically configured to: obtain an IO command scheduling sequence, the IO command scheduling sequence records the IO commands to be processed; according to the IO command scheduling sequence, The queue information corresponding to the queue to which the to-be-processed IO command belongs is determined, and the queue information corresponding to the queue to which the to-be-processed IO command belongs is determined as the high-frequency queue information.
  • the network card in this application can also predict high-frequency queue information according to any two or three prediction methods described above, and store the predicted high-frequency queue information in the cache space of the network card.
  • the processing unit is specifically configured to: read the high-frequency queue information from the memory; store the high-frequency queue information in the buffer space .
  • the processing unit is specifically configured to: determine that the high-frequency queue information has been stored in the cache space; and set the high-frequency queue in the cache space State information of the information, where the state information is used to indicate that the high-frequency queue information continues to be stored in the buffer space.
  • the status information includes priority information or lock information
  • the priority information is used to indicate the priority of the high-frequency queue information being updated in the buffer space.
  • Level the locking information is used to indicate that the high-frequency queue information is in a non-updated locked state in the buffer space.
  • the priority information or the lock information may be represented by a status flag bit.
  • the queue information includes one or more of the following information: queue pair context QPC, completion queue context CQC, and event queue context EQC.
  • the processing unit is further configured to: update or replace part or all of the queue information stored in the buffer space according to priority information or lock information.
  • the processing unit is specifically configured to: state information in the buffer space of the network card, and divide the queue information in the buffer space into levels, where the higher the level The queue information of is more likely to be accessed; priority is given to updating the queue information of low level stored in the buffer space.
  • a network card including: the chip in the second aspect or any one of the possible implementation manners of the second aspect.
  • a server including a memory and a network card as in the third aspect.
  • Fig. 1 is a schematic diagram of a possible server system provided by an embodiment of the present application.
  • Fig. 2 is a schematic flowchart of a method for a server to process an IO command according to an embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of a possible server 110 provided by an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of queue information stored in a buffer space on a network card provided by an embodiment of the present application.
  • FIG. 5 is a schematic flowchart of a method for updating queue information in a buffer space provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of QPC priorities divided in a buffer space on a network card according to an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of a chip 700 provided by an embodiment of the present application.
  • IO commands can be divided into read commands and write commands, which refer to commands issued by an application program running on the server to instruct to read data to or write data to a remote device.
  • the processor of the server can receive the IO command and store it in the memory so that the IO command is waiting to be processed. Specifically, the IO command can be stored in a queue of the memory.
  • IO commands mentioned in the embodiments of this application can be understood as IO commands to be processed.
  • IO commands can be processed by the network card.
  • a queue is a special linear table. Delete operations can be performed at the front of the table (front) and insert operations can be performed at the back of the table (rear).
  • the end that performs the insertion operation is called the end of the team, and the end that performs the deletion operation is called the head of the team.
  • the data elements of the queue are also called queue elements. Inserting a queue element into the queue is called enqueuing, and deleting a queue element from the queue is called dequeuing.
  • the queue can be inserted at one end and deleted at the other end.
  • the queue can also be called a first in first out (FIFO) linear table.
  • send queue SQ
  • receive queue RQ
  • complete queue CQ
  • event queue event queue
  • the sending queue of the local server and the receiving queue of the opposite server can be called a queue pair (QP).
  • QP queue pair
  • the sending queue can be used to store IO commands to be processed; the receiving queue is used to store memory information required for processing IO commands.
  • the sending queue in the local server is used to store the IO command issued by the local server to instruct to read or write data to the peer server.
  • the IO command is to read the storage in the peer server.
  • the network card in the local server can send the processed read command to the peer server.
  • the read command can include the address and length of the data stored in the peer server that need to be read, so that The opposite server can send the data it needs to read to the local server according to the processed read command.
  • the IO command is a write command to write data to the peer server.
  • the network card in the local server processes the write command, it sends the processed write command to the peer server, so that the peer server
  • the memory information in the receiving queue can be found according to the processed write command, and the data in the processed write command can be stored in the memory of the opposite server according to the found memory information.
  • the sending queue in the opposite server can also store the IO commands issued by the opposite server to instruct to read or write data to the local server, and send it to the local server through the network card in the opposite server.
  • the IO commands issued by the opposite server to instruct to read or write data to the local server, and send it to the local server through the network card in the opposite server.
  • the completion queue is used to store completion commands.
  • the completion information can be stored in the completion queue, and the completion information can also be referred to as a completion command.
  • the event queue is used to store event commands.
  • an event command can be generated when the completion command in the completion queue reaches a certain number.
  • the event command may include: event type, completion queue index. In order to trigger the processor to process one or more completion commands stored in the completion queue.
  • storing event commands in the event queue can prevent the network card in the server from frequently triggering the processor to process the completion commands stored in the completion queue after storing a completion command in the completion queue.
  • the context information of the queue may also be referred to as queue information.
  • the queue information corresponds to the queue one-to-one and is used to process the IO commands in the queue corresponding to the queue information.
  • the possibility of accessing at least one queue information stored in the server can be predicted. If the possibility of accessing a certain queue information is greater than the possibility of accessing other queue information, the queue information can be called High-frequency queue information. In other words, the high frequency queue information is more likely to be accessed.
  • High-frequency queue information For specific methods for determining high-frequency queue information, please refer to the method described below, which will not be detailed here.
  • queue information may include one or more of the following information: queue pair context (queue pair context, QPC), completion queue context (complete queue context, CQC), event queue context (event queue context, EQC) .
  • QPC is used by the network card in the server to process the IO commands stored in the QP corresponding to the QPC
  • CQC is used by the processor to process the completion commands stored in the CQ corresponding to the CQC
  • EQC is used by the processor in the EQ corresponding to the EQC The stored time command is processed.
  • the server may also store state information corresponding to each queue information in at least one queue information, and the state information is used to indicate the possibility that the queue information corresponding to the state information is accessed.
  • QPC is the context of the queue pair, and corresponds to the QP storing the IO commands to be processed in a one-to-one correspondence.
  • the network card processes the IO command to be processed according to the QPC, it needs to determine the QPC corresponding to the queue according to the queue to which the IO command belongs, and process the IO command to be processed according to the QPC.
  • RDMA remote direct memory access
  • RDMA is a memory access technology that quickly transfers data stored in the memory of one device to the memory of other devices without the intervention of the operating systems of both parties.
  • RDMA technology can be suitable for high-throughput, low-latency network communication, and is especially suitable for use in large-scale parallel computer clusters.
  • the local server of communication can transmit the data that needs to be transmitted to the network card of the remote server through the network card, and the network card of the remote server can transmit the data to be transmitted to the remote server.
  • the network card of the remote server can transmit the data to be transmitted to the remote server.
  • Fig. 1 is a schematic diagram of a possible server system provided by an embodiment of the present application.
  • the server system may include at least two servers.
  • the server 110 and the server 120 are described as examples in FIG. 1.
  • the server 110 and the server 120 may also include other devices such as a communication interface and a magnetic disk as an external memory, which is not limited here.
  • the server 110 may include a memory 111, a processor 112, and a network card 113.
  • the server 110 may further include a bus 114.
  • the memory 111, the processor 112, and the network card 113 may be connected through the bus 114.
  • the bus 114 may be a peripheral component interconnect express (PCIE) bus or an extended industry standard architecture (EISA) bus.
  • PCIE peripheral component interconnect express
  • EISA extended industry standard architecture
  • the bus 114 can be divided into an address bus, a data bus, a control bus, and so on. For ease of representation, only one thick line is used in FIG. 1, but it does not mean that there is only one bus or one type of bus.
  • the processor 112 is the computing core and control unit of the server 110.
  • the processor 112 may include multiple processor cores (cores).
  • the processor 112 may be a very large scale integrated circuit.
  • An operating system and other software programs are installed in the processor 112, so that the processor 112 can implement access to the memory 111, cache, disk, and network card 113.
  • the core in the processor 112 may be, for example, a central processing unit (CPU), a graphics processing unit (GPU) or other specific integrated circuits. (application specific integrated circuit, ASIC).
  • processor 112 in the embodiments of the present application may also be other general-purpose processors, digital signal processors (digital signal processors, DSP), application specific integrated circuits (application specific integrated circuits, ASICs), ready-made programmable gate arrays ( field programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc.
  • DSP digital signal processors
  • ASIC application specific integrated circuits
  • FPGA ready-made programmable gate arrays
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the storage 111 is the main storage of the server 110.
  • the memory 111 is generally used to store various running software programs in the operating system, input output (IO) commands issued by upper-level applications, and information exchanged with external memory.
  • IO input output
  • the memory 111 needs to have the advantage of fast access speed.
  • dynamic random access memory (DRAM) is used as the memory 111.
  • the processor 112 can access the memory 111 at a high speed through a memory controller (not shown in FIG. 1), and perform a read operation and a write operation on any storage unit in the memory 111.
  • the memory 111 in the embodiment of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory.
  • the non-volatile memory can be read-only memory (ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), and electrically available Erase programmable read-only memory (electrically EPROM, EEPROM) or flash memory.
  • the volatile memory may be random access memory (RAM), which is used as an external cache.
  • RAM random access memory
  • static random access memory static random access memory
  • DRAM dynamic random access memory
  • DRAM synchronous dynamic random access memory
  • Access memory synchronous DRAM, SDRAM
  • double data rate synchronous dynamic random access memory double data rate SDRAM, DDR SDRAM
  • enhanced synchronous dynamic random access memory enhanced SDRAM, ESDRAM
  • synchronous connection dynamic random access memory Take memory (synchlink DRAM, SLDRAM) and direct memory bus random access memory (direct rambus RAM, DR RAM).
  • the network card 113 is used to enable the server 110 to communicate with other servers in the communication network.
  • the network card may be built into the server 110, or may also be used as an external device of the server 110, and connected to the server 110 through an interface.
  • the interface may be a network interface (network interface).
  • network interface network interface
  • PCIE interface PCIE interface
  • the server 120 may include a memory 121, a processor 122, and a network card 123.
  • the server 120 may further include a bus 124.
  • the internal structure of the server 120 may be similar to that of the server 110, for example: the memory 121, the processor 122, and the network card 123 are respectively similar to the memory 111, the processor 112, and the network card 113 in the aforementioned server 110.
  • the server 110 please refer to the above description of the server 110. The description of each part will not be repeated here.
  • a communication network including the server 110 and the server 120 is taken as an example.
  • the server 110 and the server 120 respectively run applications (application, APP), for example, the "weather forecast" APP.
  • APP application
  • the processor 112 in the server 110 is responsible for part of the calculation and stores the calculation result in the memory 111
  • the processor 122 in the server 120 is responsible for the other part of the calculation and performs the calculation.
  • the result is stored in the memory 121.
  • the processor 122 in the server 120 performs the calculation results stored in the memory 111 and the calculation results stored in the memory 121.
  • the “weather forecast” APP running in the server 110 will issue an IO command, which is a write command and is used to instruct the calculation result stored in the memory 111 to be written into the memory 121.
  • the processor 112 in the server 110 may send the above-mentioned IO command to the memory 111 through the bus 114.
  • the network card 113 can obtain the above-mentioned IO command from the memory 111 through the bus 114 and process the above-mentioned IO command.
  • the IO command is a write command.
  • the network card 113 obtains from the memory 111 the data to be written to the memory 121 indicated by the write command.
  • the network card 113 transmits the data to the network card 123 of the server 120 through the network.
  • the network card 123 can receive the data sent by the network card 113 and write the data into the memory 121 via the bus 124.
  • the network card 123 can also send the processing result of writing data to the memory 121 to the network card 113 via the network, and the network card 113 stores the result to the memory 111 via the bus 114.
  • the result is used to indicate that the network card 123 has requested the processor 112 to the memory 121
  • the written data is successfully stored in the memory 121.
  • Fig. 2 is a schematic flowchart of a method for a server to process an IO command according to an embodiment of the present application. As shown in FIG. 2, the method may include steps 210-240, and steps 210-240 will be described in detail below.
  • Step 210 The processor 112 in the server 110 sends the to-be-processed IO command to the memory 111.
  • the IO commands to be processed may be stored in the sending queue of the memory 111, and the sending queue may store one or more IO commands to be processed.
  • the information in the IO command may include, but is not limited to: the queue index of the queue to which the IO command belongs, the producer index (PI), and information related to the IO command.
  • PI represents the position of the pending IO command in the queue.
  • PI can also be understood as the number of IO commands to be processed in the queue.
  • the order of the IO commands to be processed in the queue may be counting from the head of the queue to the end of the queue, adding a pending IO command to the QP, and the PI count plus 1.
  • PI may also be called a write pointer (WT-POINTER), and is maintained by an upper-layer application that issues an IO command in the server 110.
  • WT-POINTER write pointer
  • the IO command related information may include, but is not limited to: a key for permission verification, and the type of the IO command.
  • the key is used to verify the authority of the IO command
  • the type of the IO command can be, for example, a read command or a write command.
  • the IO command to be processed may also include: the length of the data (length), the virtual address (virtual address) of the data, and so on.
  • Step 220 The processor 112 sends a prompt message to the network card 113.
  • the processor 112 may send a prompt message to the network card 113, where the prompt message is used to indicate that there is an IO command to be processed in the memory 111.
  • the prompt message may be a door bell (DB).
  • the DB sent by the processor 112 to the network card 113 may include: the queue index of the queue to which the IO command to be processed belongs, and the position (for example, PI) of the IO command to be processed in the queue.
  • the DB may also include IO command related information included in the IO command to be processed.
  • Step 230 The network card 113 processes the IO command to be processed.
  • the network card 113 can process the IO commands to be processed according to the queue information.
  • the queue information used when processing the IO command to be processed in the embodiment of the application may be one or any combination of the following: queue pair context (queue pair context, QPC), complete queue context (complete queue context) , CQC), event queue context (event queue context, EQC).
  • the QPC corresponds to the QP one-to-one, and the QP stores the pending IO commands issued by the processor.
  • the network card 113 determines that the IO command to be processed is stored in the sending queue according to the prompt message issued by the processor 112, determines the corresponding QPC according to the sending queue storing the IO command to be processed, and processes the IO command to be processed according to the QPC. For example, the network card 113 performs permission verification on the read command or the write command in the IO command to be processed, or performs virtual address conversion of the read command or the write command.
  • the CQC corresponds to the CQ one-to-one
  • the completion command issued by the network card 113 is stored in the CQ.
  • the network card 113 may store the completed command in the CQ after processing the IO command in the sending queue.
  • the network card 113 may determine the corresponding CQC according to the CQ storing the completed command, and determine the address of the CQ according to the address information in the CQC, so that the network card 113 stores the completed command in the CQ according to the address of the CQ.
  • the EQC corresponds to the EQ one-to-one
  • the event command issued by the network card 113 is stored in the EQ.
  • the network card 113 may store the completed command in the CQ. And after the completion command in the CQ reaches a certain number, an event command is generated, and the network card 113 stores the event command in the EQ.
  • the network card 113 may determine the corresponding EQC according to the EQ storing the event command, and determine the address of the EQ according to the address information in the EQC, so that the network card 113 can store the event command in the EQ according to the address of the EQ.
  • QPC can include, but is not limited to: PI, consumer index (CI).
  • CI represents the number of IO commands that the network card 113 has processed in the sending queue corresponding to the QPC, which can also be called a read pointer (RD-POINTER), and is maintained by the network card 113.
  • RD-POINTER read pointer
  • PI is the number of IO commands to be processed in the QP.
  • PI please refer to the above description, which will not be repeated here.
  • the QPC may also include: queue status, key, and physical base address of the queue.
  • the network card 113 when the network card 113 processes the IO command to be processed, it can determine whether the queue to which the IO command to be processed belongs is available or normal according to the queue status.
  • the network card 113 can also verify the authority of the IO command to be processed when processing the IO command to be processed according to the key.
  • the network card 113 can also convert the virtual address of the read command or the write command among the pending IO commands stored in the queue according to the physical base address of the queue to which the pending IO command belongs, to obtain the read command from the pending IO command.
  • the physical address of the command or write command when the network card 113 processes the IO command to be processed, it can determine whether the queue to which the IO command to be processed belongs is available or normal according to the queue status.
  • the network card 113 can also verify the authority of the IO command to be processed when processing the IO command to be processed according to the key.
  • the QPC may also include other related data, such as one or more combinations of the following: the data length of the queue in the memory 111, the letter of credit, the working mode, and so on.
  • the network card 113 can process the IO commands to be processed according to the QPC. For ease of description, assume that the pending IO commands are stored in queue A, and queue A corresponds to QPC A. For example, the network card 113 may determine whether the queue A is available or normal according to the queue status included in the QPC A. For another example, the network card 113 may verify the authority of the IO command to be processed stored in the queue A according to the key included in the QPC A. For another example, the network card 113 can also convert the virtual address of the read command or write command among the pending IO commands stored in the queue A according to the physical base address of the queue included in QPC A, to obtain the pending IO command The physical address of the read command or write command.
  • the CQC may include: the physical base address, PI, and CI of the queue.
  • the physical base address of the queue indicates the physical base address of the CQ in the memory, so that the network card 113 can store the completion command in the CQ according to the physical base address.
  • PI represents the number of completed commands stored in the network card 113 in the CQ corresponding to the CQC.
  • the network card 113 stores a completion command and modifies the PI in the CQC corresponding to the CQ storing the completion command, and the PI count is increased by one.
  • CI represents the number of completed commands that the processor has processed in the CQ corresponding to the CQC.
  • the processor processes a completion command and modifies the CI in the CQC corresponding to the CQ storing the completion command, and the CI count is increased by one.
  • the EQC can include: the physical base address of the queue, PI, and CI.
  • the physical base address of the queue indicates the physical base address of the EQ in the memory, so that the network card 113 stores the event command in the EQ according to the physical base address.
  • PI represents the number of event commands stored in the network card 113 in the EQ corresponding to the EQC.
  • the network card 113 stores an event command and modifies the PI in the EQ corresponding to the EQ storing the event command, and the PI count is increased by one.
  • CI represents the number of event commands that the processor has processed in the EQ corresponding to the EQC.
  • the processor processes an event command and modifies the CI in the EQC corresponding to the EQ storing the event command, and the CI count is increased by one.
  • Step 240 The network card 113 sends the processed IO command to the network card 123 of the server 120 via the network.
  • the above steps 210 to 240 describe the process in which the local server processes the pending IO commands after the upper application running on the local server sends the pending IO commands. It can be seen from the above process that the network card needs to process the IO command according to the queue information. Therefore, how to quickly obtain the corresponding queue information has a greater impact on the processing speed of the IO command.
  • the network card of the server may also include a cache space, for example, a cache memory (cache space).
  • the buffer space can be used to store part of the queue information.
  • the network card processes the IO commands to be processed, it can directly obtain the stored queue information from the cache space of the network card, and process the IO commands to be processed according to the queue information, thereby avoiding the network card from frequently reading and writing the queue in the memory through the bus information.
  • the ratio of the accessed queue information cached in the cache space to all caches in the cache space within a period of time is called the hit rate of the cache space.
  • the larger the ratio the higher the hit rate of the cache space.
  • the smaller the ratio the lower the hit rate of the cache space.
  • the technical solutions provided by the embodiments of the present application can increase the hit rate of the cache space in the network card, thereby reducing the delay caused by the network card frequently reading and writing queue information stored in the memory through the bus, and the waste of bus bandwidth, and reducing the processing of the network card
  • the processing delay of IO commands improves the transmission performance.
  • FIG. 3 is a schematic structural diagram of a possible server 110 provided by an embodiment of the present application.
  • the server 110 may include a memory 111, a processor 112, and a network card 113.
  • the server 110 may further include a bus 114.
  • the memory 111, the processor 112, and the network card 113 may be connected through the bus 114.
  • the network card 113 may be in the server 110, or may also be used as an external device of the server 110, and connected to the server 110 through an interface.
  • the network card 113 is in the server 110 as an example for description.
  • the memory 111 may include multiple queues, for example, queue A, queue B, ..., queue N.
  • One or more commands can be stored in each queue. Taking the queue as the sending queue in the QP as an example, one or more pending IO commands can be stored in the QP. Taking the queue as a CQ as an example, one or more completion commands can be stored in the CQ. Taking the queue as an EQ as an example, one or more event commands can be stored in the EQ.
  • the network card 113 may include: an input processing unit 310, a buffer space 320, a prediction unit 330, and a processing unit 340. Each of the above-mentioned units will be described in detail below.
  • the input processing unit 310 is mainly used to receive a prompt message (for example, a DB) sent by the processor 112, and the DB is used to indicate that there are IO commands to be processed in the queue of the memory 111.
  • the input processing unit 310 may process the IO command to be processed. Specifically, in a possible implementation manner, the input processing unit 310 may obtain the IO command to be processed and the QPC corresponding to the queue from the queue of the memory 111, and process the IO command to be processed according to the QPC. In another possible implementation manner, the input processing unit 310 may also generate a completion command after processing the IO command. And according to the CQC corresponding to the CQ storing the completion command, the completion command is processed.
  • a prompt message for example, a DB
  • the DB is used to indicate that there are IO commands to be processed in the queue of the memory 111.
  • the input processing unit 310 may process the IO command to be processed. Specifically, in a possible implementation manner, the input processing
  • the input processing unit 310 may also generate an event command after processing the IO command. And according to the EQC corresponding to the EQ storing the event command, the event command is processed.
  • the specific processing process please refer to the above description, which will not be repeated here.
  • Cache space 320 used to store queue information, for example, queue information A, queue information B, ..., queue information M are stored in the cache space 320. Among them, M is less than N.
  • the queue information A corresponds to the queue A and is used to process the commands stored in the queue A
  • the queue information B corresponds to the queue B and is used to process the commands stored in the queue B, and so on.
  • a piece of queue information may include a queue information entry (entry) and corresponding status information.
  • DATA in the buffer space 320 is a space for storing queue information entries of queue information
  • CTRL_DATA is used to store corresponding status information of the queue information in the DATA in the buffer space 320.
  • queue information A may include queue information entry A and corresponding status information A.
  • the status information stores related status information of the queue information in the buffer space 320.
  • the status information can be represented by a flag bit, or can also be represented by a field, which is not specifically limited in this application.
  • the queue information in the embodiment of the present application may include one or more of the following: QPC, CQC, EQC.
  • the prediction unit 330 is mainly responsible for predicting the possibility that the queue information stored in the buffer space 320 will be subsequently accessed. If a certain queue information is more likely to be accessed than other queue information, the queue information can be called high-frequency queue information.
  • Processing unit 340 Mainly responsible for storing the high-frequency queue information determined by the prediction unit 330 in the buffer space, and can also update and replace the queue information stored in the buffer space 320 according to the prediction result obtained by the prediction unit 330, and the replaced ones
  • the storage space occupied by the queue information can be used to store other new queue information.
  • a “unit” herein can be implemented in the form of software and/or hardware, which is not specifically limited.
  • a “unit” may be a software program, a hardware circuit, or a combination of the two that realize the above-mentioned functions.
  • the software exists in the form of computer program instructions and is stored in the memory of the network card, and the processor of the network card can be used to execute the program instructions to implement the above method flow.
  • the processor may include, but is not limited to, at least one of the following: central processing unit (CPU), microprocessor, digital signal processing (digital signal processing, DSP), microcontroller (microcontroller unit, MCU) , Or artificial intelligence processors and other computing devices that run software.
  • Each computing device may include one or more cores for executing software instructions for calculation or processing.
  • the processor can be a single semiconductor chip, or it can be integrated with other circuits to form a semiconductor chip. For example, it can be combined with other circuits (such as codec circuits, hardware acceleration circuits, or various bus and interface circuits) to form a system-on-chip ( system on chip, SoC), or as an application-specific integrated circuit (ASIC) built-in processor integrated in the ASIC, the ASIC integrated with the processor can be packaged separately or can be combined with other The circuits are packaged together.
  • the processor may further include necessary hardware accelerators, such as field programmable gate array (FPGA) and programmable logic device (programmable logic device). device, PLD), or a logic circuit that implements dedicated logic operations.
  • FPGA field programmable gate array
  • programmable logic device programmable logic device
  • the hardware circuit may be a general-purpose central processing unit (central processing unit, CPU), microcontroller (microcontroller unit, MCU), microprocessor (microprocessing unit, MPU), Digital signal processor (digital signal processing, DSP), system on chip (system on chip, SoC) to achieve, of course, it can also be implemented by application-specific integrated circuit (ASIC), or programmable logic device (programmable logic) device, PLD).
  • the above-mentioned PLD can be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (generic array logic, GAL) or its In any combination, it can run necessary software or does not rely on software to execute the above method flow.
  • CPLD complex programmable logical device
  • FPGA field-programmable gate array
  • GAL generic array logic
  • FIG. 5 is a schematic flowchart of a method for information processing of a network card according to an embodiment of the present application. As shown in FIG. 5, the method may include steps 510-530, and steps 510-530 will be described in detail below.
  • Step 510 The prediction unit 330 predicts high-frequency queue information, which is more likely to be accessed than other queue information.
  • the prediction unit 330 may predict the probability of at least one queue information stored in the buffer space 320 being accessed, and determine the high-frequency queue information with queue information whose access probability is greater than other queue information.
  • the at least one piece of queue information stored in the buffer space 320 in the embodiment of the present application may be one or a combination of any of the following: QPC, CQC, EQC.
  • QPC QPC
  • CQC CQC
  • EQC EQC
  • the prediction unit 330 may predict the possibility that the QPC will be subsequently accessed according to whether the QPC is hit by the read request sent by the input processing unit 310.
  • the prediction unit 330 may also pre-read the IO commands to be processed (for example, obtain the IO command scheduling sequence), and obtain the relevant information of the queue to which the IO commands to be processed belongs, so as to be based on the queue The related information predicts the possibility that at least one QPC stored in the cache space 320 will be subsequently accessed.
  • the prediction unit 330 may also predict the possibility that the QPC will be subsequently accessed based on the difference between the values of the read pointer (for example, CI) and the write pointer (for example, PI) in the QPC.
  • the method of the prediction unit 330 for predicting the possibility of at least one CQC being accessed is similar to the method of predicting the possibility of at least one QPC being accessed.
  • the prediction unit 330 may predict the possibility that the CQC will be subsequently accessed according to whether the CQC is hit by the read request sent by the input processing unit 310.
  • the prediction unit 330 may also pre-read the multiple completion commands to be processed (for example, obtain the IO command scheduling sequence), and obtain the relevant information of the CQ to which the multiple completion commands to be processed belong, so as to obtain the relevant information according to the CQ.
  • the information predicts the possibility that at least one CQC stored in the cache space 320 will be subsequently accessed.
  • the method of the prediction unit 330 for predicting the possibility that at least one EQC is accessed is similar to the method for predicting the possibility that at least one QPC is accessed.
  • the prediction unit 330 may predict the possibility that the EQC will be subsequently accessed according to whether the EQC is hit by the read request sent by the input processing unit 310.
  • the prediction unit 330 may also pre-read the multiple event commands to be processed, and obtain related information about the EQ to which the multiple event commands to be processed belong, so as to check at least the information stored in the buffer space 320 according to the related information of the EQ. The probability of an EQC being visited subsequently is predicted.
  • the method by which the prediction unit 330 predicts that at least one queue information stored in the buffer space 320 is high-frequency queue information may be predicted according to any one of the foregoing methods, or may be performed based on the superposition of any two of the foregoing methods. The prediction may also be based on the superposition of any of the above three methods, which is not specifically limited in this application.
  • Step 520 The processing unit 340 saves the high-frequency queue information in the buffer space.
  • the queue information stored in the buffer space corresponds to the queue in the memory one-to-one, and each queue information is used by the network card to process the IO commands in the queue corresponding to the queue information.
  • the network card may read the high-frequency queue information from the memory, and store the high-frequency queue information in the buffer space.
  • the network card determines that the high-frequency queue information has been stored in the cache space, and sets the state information of the high-frequency queue information in the cache space, and the state information is used to indicate the high-frequency queue information Continue to be stored in the cache space.
  • the status information is not specifically limited, and may be priority information or lock information.
  • the priority information is used to indicate the priority at which the high-frequency queue information is updated in the cache space
  • the lock information is used to indicate that the high-frequency queue information is in a non-updated locked state in the cache space.
  • the processing unit 340 adjusts the state information corresponding to the high-frequency queue information according to the prediction result.
  • the prediction unit 330 may predict the possibility that at least one queue information stored in the buffer space 320 will be subsequently accessed, and the processing unit 340 sets the state information corresponding to the predicted high-frequency queue information, and the high-frequency queue information is stored in the buffer space.
  • One or more of the queue information is determined to be the high-frequency queue information.
  • the probability of being accessed is greater than the probability of being accessed of other queue information in the buffer space.
  • a flag bit corresponding to the high-frequency queue information can be set, for example, a setting operation is performed on the flag bit.
  • the field corresponding to one or more queue information in the at least one queue information may also be modified.
  • the flag bit corresponding to the high-frequency queue information may include one or any combination of the following: valid (valid), dirty (dirty), lock (lock), etc. Among them, the valid flag bit indicates whether the queue information entry is valid, the dirty flag bit indicates whether the queue information entry is dirty data, and the lock flag bit indicates whether the queue information entry is locked.
  • lock flag bits there may be one or more lock flag bits in the embodiment of this application, and the specific number of lock flag bits is not specifically limited in this application.
  • Step 530 The processing unit 340 updates part or all of the queue information stored in the buffer space 320 according to the state information corresponding to the queue information in the buffer space.
  • the processing unit 340 may classify the queue information in the buffer space according to the priority information of the queue information stored in the buffer space.
  • the queue information is more likely to be accessed; and priority is given to updating the low-level queue information stored in the cache space.
  • the processing unit 340 may divide the queue information in the buffer space into levels according to the priority information, wherein the higher the level, the more likely the queue information to be accessed ; And priority to update the low-level queue information stored in the cache space.
  • the high-frequency queue information it is possible to determine the high-frequency queue information by predicting the possibility that the queue information stored in the cache space of the network card will be accessed, and optimize the replacement or update strategy of the queue information in the cache space to avoid replacing those that will be subsequently
  • the used high-frequency queue information improves the hit rate of the network card's cache space, reduces the number of bus read and write accesses generated by the network card, reduces the waste of bus bandwidth, reduces the processing delay of the IO commands to be processed by the network card, and improves the transmission performance.
  • the queue information stored in the cache space is QPC as an example, and the possibility of access to at least one QPC stored in the cache space in the foregoing steps 510 and 520 is predicted and different implementations of the state information of the high-frequency queue information are set.
  • QPC the queue information stored in the cache space
  • the prediction unit 330 can determine the cache space 320 Whether a certain stored QPC is read, it is determined that the possibility of subsequent access to the QPC is relatively high, and the QPC is determined to be high-frequency queue information. That is to say, the network card searches the QPC cached in the buffer space for the currently read QPC, and determines the currently read QPC as the high-frequency queue information.
  • the input processing unit 310 determines that the IO command to be processed needs to be processed according to QPC A, and the input processing unit 310 needs to read the QPC A. After the pending IO command is processed, the read pointer (for example, CI) in the QPC A needs to be modified. Therefore, the QPC A needs to be written subsequently.
  • the read pointer for example, CI
  • the processing unit 340 may set the state information corresponding to these QPCs.
  • a flag bit corresponding to QPC can be set.
  • a flag bit in the embodiment of the present application may include lock1.
  • the processing unit 340 may set the lock 1 flag bit corresponding to the QPC. For example, setting the lock 1 flag bit to 1, and the lock 1 flag bit to 1 indicates that the QPC is more likely to be accessed subsequently.
  • the processing unit 340 may clear the lock 1 flag bit corresponding to the QPC, for example, set the lock 1 flag bit to 0, lock1
  • the flag bit being 0 means that the QPC is less likely to be accessed subsequently.
  • the prediction unit 330 may also obtain the scheduling sequence of the IO commands to be processed, and determine the QPC corresponding to the queue to which the IO commands to be processed belongs according to the scheduling sequence of the IO commands, The QPC corresponding to the queue to which the to-be-processed IO command belongs is determined as the high-frequency queue information. It should be understood that the scheduling sequence of the IO commands records the IO commands to be processed. That is to say, before the processing of the pending IO command, the prediction unit 330 may predict the possibility that the QPC stored in the buffer space 320 will be read in the short term according to the pre-reading result of the pending IO command.
  • the input processing unit 310 receives multiple prompt messages (for example, DBs) sent by the processor 112, and the multiple DBs indicate that there are multiple IO commands to be processed in the server 110.
  • the input processing unit 310 may pre-read multiple DBs before processing the multiple pending IO commands, and send the pre-read results to the prediction unit 330.
  • the input processing unit 310 may determine the queue to which the IO command to be processed belongs according to the queue index of the queue to which the IO command to be processed belongs to, and the position (for example, PI) of the IO command in the queue included in the DB. information.
  • the prediction unit 330 may determine corresponding multiple QPCs according to the queue information to which the multiple pending IO commands sent by the input processing unit 310 belong, and determine that the multiple QPCs are high-frequency queue information.
  • the processing unit 340 sets the state information corresponding to the multiple QPCs.
  • the flag bits corresponding to these QPCs can be set.
  • a flag bit in the embodiment of the present application may include lock 2.
  • the prediction unit 330 may set the lock 2 flag bit corresponding to QPC A, for example, set the lock 2 flag bit to 1.
  • the network card may obtain the foregoing multiple QPCs from the memory 111 in advance and store them in the cache space 320. In this way, the multiple QPCs can be obtained from the memory 111 in advance, avoiding a large IO processing delay caused by obtaining the multiple QPCs from the memory 111 when processing IO commands.
  • the prediction unit 330 may also predict subsequent reads and writes to the QPC based on the PI and CI of the QPC stored in the read buffer space 320, and based on the difference between PI and CI access.
  • the read-write pointer difference is greater than the preset threshold, it indicates that the QPC is more likely to be accessed subsequently, and it can be determined that the QPC is high-frequency queue information.
  • PI represents the number of IO commands in the queue corresponding to the QPC stored in the buffer space 320, and the order of the IO commands in the queue may be counted from the head of the queue to the end of the queue.
  • CI represents the number of IO commands processed in the queue corresponding to the QPC. When an IO command is processed, the CI count is increased by 1. Therefore, if the difference between PI and CI is large, the larger the PI and the smaller the CI, the larger the number of pending IO commands stored in the queue, the subsequent QPC corresponding to the queue is subsequently accessed The probability is also greater.
  • the prediction unit 330 may compare the difference between the PI and the CI in the QPC in real time, and when the difference exceeds a certain preset threshold, the processing unit 340 may set the state information corresponding to the QPC.
  • the flag bit corresponding to QPC can be set.
  • a flag bit in the embodiment of the present application may include a lock (lock) 3.
  • the processing unit 340 may set the lock 3 flag corresponding to QPC A, for example, set the lock 3 flag to 1.
  • the processing unit 340 may clear the lock 3 flag bit corresponding to the QPC, for example, set the lock 3 flag bit to 0.
  • the three prediction methods listed above can be used to determine the high-frequency queue information in the buffer space by one of them or a combination of any two or three prediction methods.
  • the setting of status information is realized by setting a flag bit as an example.
  • the flag bit can be set to one or multiple.
  • the setting of the number of flag bits is related to the selected prediction method, which is not specifically limited in this application. For example, if the prediction result is obtained by one of these methods, a flag bit, for example, a lock flag bit, can be set. For another example, if the prediction result is obtained through a combination of any of the above two methods, two flag bits can be set, for example, the lock 1 flag and the lock 2 flag. For another example, if the prediction result is obtained through the combination of the above three methods, three flags can be set, for example, lock 1 flag, lock 2 flag, and lock 3 flag.
  • the method for predicting the probability of at least one CQC or EQC being accessed by the prediction unit 330 is similar to the method for predicting the probability of at least one QPC being accessed. For example, since the input processing unit 310 in the network card 113 has read and write access to the CQC or EQC stored in the cache space 320 in pairs, the network card 113 will modify the CQC after reading the CQC or EQC in the cache space 320. Or the PI pointer in EQC. Therefore, the prediction unit 330 can determine whether a certain CQC or EQC stored in the buffer space 320 is read to determine that the subsequent access to the CQC or EQC is more likely, and the processing unit 340 can adjust the state corresponding to the CQC or EQC. information.
  • the prediction unit 330 may also perform processing of the pending completion command or event command according to the scheduling sequence of the pending completion command or event command, and compare the buffer space 320 according to the pre-reading result of the pending completion command or event command.
  • the possibility of short-term reading of the CQC or EQC stored in it is predicted.
  • the specific prediction process and the process of setting status information according to the prediction result please refer to the QPC prediction and status information setting method mentioned above, which will not be repeated here.
  • the following uses the prediction result obtained by the combination of the above three prediction methods, and the flag bit corresponding to at least one queue information is set according to the prediction result as an example.
  • the specific implementation process of the replacement of queue information by the processing unit 340 is described in detail.
  • the processing unit 340 may divide the at least one QPC entry stored in the cache space 320 into several priority levels according to the lock flag bit corresponding to the QPC set by the prediction unit 330.
  • FIG. 6 takes the division of at least one QPC entry into four levels as an example for description.
  • Level 1 A QPC entry in the cache space 320 that is likely to be accessed in a short period of time, and the lock1 flag corresponding to the QPC entry is set.
  • the other lock flag bits for example, the lock2 flag bit and the lock3 flag bit may be 1, or may also be 0, which is not specifically limited in this application.
  • Level 2 The QPC entry in the cache space 320 that is likely to be accessed in the short term, the lock 2 flag corresponding to the QPC entry is set, and the lock 1 flag is not set.
  • the lock 2 flag bit corresponding to the QPC entry is 1, and the lock 1 flag bit is 0.
  • the other lock flag bits, for example, the lock 3 flag bit may be 1, or may also be 0, which is not specifically limited in this application.
  • Level 3 QPC entries in the cache space 320 that are likely to be accessed in the long term, the lock 3 flag corresponding to the QPC entry is set, and the lock 1 flag and the lock 2 flag are not set.
  • the lock 3 flag bit corresponding to the QPC entry is 1, the lock 1 flag bit and the lock 2 flag bit are 0.
  • Level 4 QPC entries in the cache space 320 that are less likely to be accessed for a long time, and the lock1 flag, lock2 flag, and lock3 flag bits corresponding to the QPC entry are not set. In other words, the lock1 flag, lock2 flag, and lock3 flag bits corresponding to the QPC entry are all 0.
  • the processing unit 340 may store the new QPC in the unoccupied space. If there is no unoccupied space in the cache space 320, replacement will occur, and the processing/changing unit 340 needs to delete part of the QPC and store the new QPC in the storage space occupied by the deleted QPC.
  • the priority of the processing unit 340 when performing replacement is from high to low: level 4-level 3-level 2-level 1.
  • the processing unit 340 in the embodiment of the present application can be replaced according to the meaning of the lock flag bit.
  • three lock flags are not set QPC, for example, the QPC corresponding to level 4, the possibility of these QPCs being accessed in the subsequent access process If it is lower, the processing unit 340 may preferentially consider replacing the QPC corresponding to level 4. As another example, if there is no QPC corresponding to level 4, the processing unit 340 may consider replacing the QPC corresponding to level 3. These QPCs will have a large number of read and write accesses in the future, but these IO commands have not been scheduled in the short term, so , You can also consider replacing the QPC corresponding to level 3. As another example, if there is no QPC corresponding to level 3, the processing unit 340 may consider replacing the QPC corresponding to level 2. As another example, if there is no QPC corresponding to level 2, the processing unit 340 may finally consider replacing the QPC corresponding to level 1.
  • the network card can predict the possibility of accessing the QPC stored in the cache space in advance, thereby avoiding the need to update the QPC in the cache space, replacing it with the QPC that will be used later, and optimizing the replacement strategy of the cache space , Thereby improving the hit rate of the cache space of the network card.
  • the processing unit 340 replaces the stored CQC or EQC according to the predicted result of the CQC being accessed or the predicted result of the EQC being accessed, and the specific implementation process of replacing the stored CQC or EQC is similar to the above method. The method of replacing the QPC with the prediction result will not be repeated here.
  • FIG. 7 is a schematic structural diagram of a chip 700 provided by an embodiment of the present application.
  • the chip 700 is applied to a server system.
  • the local server and the remote server in the server system perform data transmission through remote direct memory access RDMA.
  • At least one queue is stored in the memory of the local server, and each queue is used to store input and output IO commands.
  • the IO commands instruct the local server to access data to the remote server.
  • the chip 700 includes :
  • the prediction unit 330 is configured to predict high-frequency queue information, which is more likely to be accessed than other queue information;
  • the processing unit 340 is configured to store the high-frequency queue information in a cache space, where the cache space is in the network card of the local server, and the queue information stored in the cache space is the same as the queue in the memory.
  • each queue information is used by the network card to process the IO commands in the queue corresponding to the queue information.
  • processing unit 340 is further configured to: update or replace part or all of the queue information stored in the buffer space.
  • the prediction unit 330 is specifically configured to: search for the currently read queue information in the queue information cached in the buffer space, and determine the currently read queue information as the high-frequency queue information.
  • the queue information is the queue pair context QPC
  • the prediction unit 330 is specifically configured to: calculate the difference between the read pointer and the write pointer in the QPC cached in the buffer space, and compare the read pointer and the write pointer.
  • the QPC whose write pointer difference is greater than the preset threshold is determined as the high-frequency queue information.
  • the prediction unit 330 is specifically configured to: obtain the IO command scheduling sequence, the IO command scheduling sequence records the IO commands to be processed; according to the IO command scheduling sequence, determine the IO command to be processed belongs The queue information corresponding to the queue of, and the queue information corresponding to the queue to which the to-be-processed IO command belongs is determined as the high-frequency queue information.
  • the network card in this application can also predict high-frequency queue information according to any two or three prediction methods described above, and store the predicted high-frequency queue information in the cache space of the network card.
  • the processing unit 340 is specifically configured to: read the high-frequency queue information from the memory; and store the high-frequency queue information in the buffer space.
  • the processing unit 340 is specifically configured to: determine that the high-frequency queue information has been stored in the cache space; set the state information of the high-frequency queue information in the cache space, and the state information It is used to indicate that the high-frequency queue information continues to be stored in the buffer space.
  • the status information includes priority information or lock information
  • the priority information is used to indicate the priority at which the high-frequency queue information is updated in the buffer space
  • the lock information is used to indicate all The high-frequency queue information is in a non-updated locked state in the buffer space.
  • priority information or lock information may be represented by status flag bits.
  • the queue information includes one or more of the following information: queue pair context QPC, completion queue context CQC, and event queue context EQC.
  • processing unit 340 is further configured to: update or replace part or all of the queue information stored in the buffer space according to priority information or lock information.
  • the processing unit 340 is specifically configured to: classify the queue information in the cache space according to the status information in the cache space of the network card, wherein the queue information with a higher level is more likely to be accessed. Large; priority is given to updating the low-level queue information stored in the buffer space.
  • the size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not correspond to the embodiments of this application.
  • the implementation process constitutes any limitation.
  • the embodiment of the present application also provides a network card, which includes the chip 700 described in any one of the above.
  • a network card which includes the chip 700 described in any one of the above.
  • the network card please refer to Figure 3 and the description of the network card 113, which will not be repeated here.
  • the embodiment of the present application also provides a server, which includes a memory, a processor, a network card, and the like.
  • a server which includes a memory, a processor, a network card, and the like.
  • the disclosed system, device, and method may be implemented in other ways.
  • the device embodiments described above are merely illustrative, for example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • 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 units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the technical solution of the present application essentially or the part that contributes to the existing technology 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 Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), magnetic disks or optical disks and other media that can store program codes. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The present application provides a network card information processing method, a local server and a remote server perform data transmission through RDMA, at least one queue is stored in a memory of the local server, each queue is used to store IO commands, and the IO commands instruct the local server to perform data access to the remote server, the method comprises: a network card predicts high-frequency queue information, the possibility of accessing the high-frequency queue information is greater than that of other queue information, the high-frequency queue information is stored in a cache space, the cache space is in the network card, the queue information stored in the cache space is in one-to-one correspondence with the queues in the memory, and information of each queue is used by the network card to process the IO commands in the queue corresponding to the queue information. The present application can improve the hit rate of the cache space.

Description

网卡的信息处理方法及芯片Information processing method and chip of network card 技术领域Technical field
本申请涉及服务器领域,并且更具体地,涉及一种网卡的信息处理方法及用于进行网卡的信息处理的芯片。The present application relates to the field of servers, and more specifically, to an information processing method of a network card and a chip for information processing of the network card.
背景技术Background technique
在数据中心的网络系统中,为了避免网络传输中服务器端数据处理的延迟,可以使用远程直接内存存取(remote direct memory access,RDMA)技术。在使用RDMA技术时,通信的本端服务器可以通过网卡将需要传输的数据传输至远端服务器的网卡中,并由该远端服务器的网卡将该需要传输的数据传输至远端服务器的内存中。In the network system of the data center, in order to avoid the delay of server-side data processing in network transmission, remote direct memory access (RDMA) technology can be used. When using RDMA technology, the local server of communication can transmit the data to be transmitted to the network card of the remote server through the network card, and the network card of the remote server can transfer the data to be transmitted to the memory of the remote server .
在实际业务中,本端服务器接收到待处理的输入输出(input output,IO)命令后,需要通过网卡对该待处理的IO命令进行处理,将处理后的IO命令发送至对端服务器的网卡中。网卡可以获取队列信息(例如,队列对的上下文(queue pair context,QPC))对待处理的IO命令进行处理,通常这些队列信息存储在服务器的存储器中,为了避免网卡频繁通过总线读写存储器中的队列信息,可以在网卡的缓存空间中缓存部分队列信息。由于网卡中缓存空间的规模较小,因此,需要对网卡的缓存空间中缓存的队列信息进行更新,如何提高网卡的缓存空间的命中率,减少由于网卡频繁通过总线读写存储器中存储的队列信息所造成的延时以及总线带宽的浪费成为当前亟需要解决的问题。In actual business, after the local server receives the input output (IO) command to be processed, it needs to process the pending IO command through the network card, and send the processed IO command to the network card of the opposite server in. The network card can obtain queue information (for example, the queue pair context (QPC)) to process the IO commands to be processed. Usually, the queue information is stored in the memory of the server. In order to avoid the network card from frequently reading and writing data in the memory through the bus Queue information, part of the queue information can be buffered in the buffer space of the network card. Due to the small scale of the cache space in the network card, it is necessary to update the queue information cached in the cache space of the network card. How to improve the hit rate of the cache space of the network card and reduce the frequent read and write of the queue information stored in the memory due to the network card through the bus The resulting delay and the waste of bus bandwidth have become problems that need to be resolved urgently.
发明内容Summary of the invention
本申请提供了一种网卡的信息处理方法、芯片,可以提高缓存空间的命中率。The present application provides an information processing method and chip for a network card, which can improve the hit rate of the cache space.
第一方面,提供了一种网卡的信息处理方法,本端服务器与远端服务器通过远程直接内存存取RDMA进行数据传输,本端服务器的存储器中保存有至少一个队列,每个队列用于保存输入输出IO命令,IO命令指示所述本端服务器向远端服务器进行数据访问,该方法包括:网卡预测高频队列信息,高频队列信息被访问的可能性大于其他队列信息;网卡在缓存空间中保存所述高频队列信息,其中,缓存空间在该网卡中,缓存空间保存的队列信息与本端服务器的存储器中的队列一一对应,每个队列信息用于该网卡对该队列信息对应的队列中的IO命令进行处理。In the first aspect, an information processing method for a network card is provided. The local server and the remote server perform data transmission through remote direct memory access RDMA. The memory of the local server stores at least one queue, and each queue is used for storage. Input and output IO commands. The IO command instructs the local server to access data to the remote server. The method includes: the network card predicts high-frequency queue information, and the high-frequency queue information is more likely to be accessed than other queue information; the network card is in the cache space The high-frequency queue information is stored in the network card, where the buffer space is in the network card, the queue information stored in the buffer space corresponds to the queue in the memory of the local server, and each queue information is used for the network card to correspond to the queue information IO commands in the queue are processed.
上述技术方案中,可以对高频队列信息进行预测,并将高频队列信息保存在网卡的缓存空间中,从而提高网卡的缓存空间的命中率,进一步地可以减少该网卡产生的总线读写访问次数,减少总线带宽浪费,降低网卡对待处理的IO命令的处理延时,提高服务器的传输性能。In the above technical solution, the high-frequency queue information can be predicted, and the high-frequency queue information can be stored in the cache space of the network card, thereby improving the hit rate of the cache space of the network card, and further reducing the bus read and write access generated by the network card Reduce the waste of bus bandwidth, reduce the processing delay of the IO commands to be processed by the network card, and improve the transmission performance of the server.
在第一方面的另一种可能的实现方式中,网卡预测高频队列信息具体包括:网卡在缓存空间中缓存的队列信息中查找当前被读取的队列信息,将当前被读取的队列信息确 定为高频队列信息。In another possible implementation of the first aspect, the network card predicting the high-frequency queue information specifically includes: the network card searches the queue information currently being read in the queue information cached in the buffer space, and replaces the currently read queue information Determined as high-frequency queue information.
上述技术方案中,由于缓存空间中队列信息的读写访问是成对出现的,如果某一个队列信息接收到读请求,那么在短期内该队列信息被访问到的可能性较大,可以将该当前被读取的队列信息确定为高频队列信息,可以提高缓存空间的命中率。In the above technical solution, since the read and write access to the queue information in the buffer space occurs in pairs, if a read request is received for a certain queue information, then the queue information is more likely to be accessed in a short period of time. The currently read queue information is determined to be high-frequency queue information, which can improve the hit rate of the cache space.
在第一方面的另一种可能的实现方式中,网卡预测高频队列信息具体包括:队列信息为队列对上下文QPC,网卡计算缓存空间中缓存的QPC中的读指针和写指针的差值,将读指针和写指针的差值大于预设阈值的QPC确定为高频队列信息。In another possible implementation of the first aspect, the network card predicts the high-frequency queue information specifically including: the queue information is the queue pair context QPC, and the network card calculates the difference between the read pointer and the write pointer in the QPC cached in the cache space, The QPC with the difference between the read pointer and the write pointer greater than the preset threshold is determined as the high-frequency queue information.
上述技术方案中,可以根据QPC中的读指针和写指针的差值,确定该QPC对应的队列中待处理的IO命令的数量,从而根据待处理的IO命令的数量确定该QPC后续被访问的可能性,从而提高缓存空间的命中率。In the above technical solution, the number of IO commands to be processed in the queue corresponding to the QPC can be determined according to the difference between the read pointer and the write pointer in the QPC, so as to determine the number of IO commands to be processed subsequently to be accessed by the QPC. Possibility to improve the hit rate of the cache space.
在第一方面的另一种可能的实现方式中,网卡预测高频队列信息具体包括:网卡获取IO命令调度顺序IO命令调度顺序记录了待处理的IO命令;网卡根据IO命令调度顺序,确定待处理的IO命令所属的队列对应的队列信息,将待处理的IO命令所属的队列对应的队列信息确定为高频队列信息。In another possible implementation of the first aspect, the network card predicting high-frequency queue information specifically includes: the network card obtains the IO command scheduling sequence, the IO command scheduling sequence records the pending IO commands; the network card determines the pending IO commands according to the IO command scheduling sequence The queue information corresponding to the queue to which the processed IO command belongs, and the queue information corresponding to the queue to which the IO command to be processed belongs is determined as high frequency queue information.
上述技术方案中,可以先对未处理的IO命令进行预读,根据未处理的IO命令所属的队列信息确定处理该IO命令需要的队列信息,该队列信息后续被访问到的可能性较大,可以将该队列信息确定为高频队列信息,从而提高缓存空间的命中率。In the above technical solution, the unprocessed IO command can be pre-read first, and the queue information required to process the IO command is determined according to the queue information to which the unprocessed IO command belongs. The queue information is more likely to be accessed later. The queue information can be determined as high-frequency queue information, thereby improving the hit rate of the cache space.
需要说明的是,本申请中所述网卡还可以根据上述任意两种或三种预测方法预测高频队列信息,并将预测的高频队列信息保存在网卡的缓存空间中。It should be noted that the network card in this application can also predict high-frequency queue information according to any two or three prediction methods described above, and store the predicted high-frequency queue information in the cache space of the network card.
即:which is:
在第一方面的另一种可能的实现方式中,网卡预测高频队列信息具体包括:网卡在缓存空间中缓存的队列信息中查找当前被读取的队列信息,将当前被读取的队列信息确定为高频队列信息,和,队列信息为队列对上下文QPC时,网卡计算缓存空间中缓存的QPC中的读指针和写指针的差值,将读指针和写指针的差值大于预设阈值的QPC确定为高频队列信息。In another possible implementation of the first aspect, the network card predicting the high-frequency queue information specifically includes: the network card searches the queue information currently being read in the queue information cached in the buffer space, and replaces the currently read queue information When it is determined to be the high-frequency queue information, and, when the queue information is the queue pair context QPC, the network card calculates the difference between the read pointer and the write pointer in the QPC cached in the cache space, and the difference between the read pointer and the write pointer is greater than the preset threshold The QPC is determined as the high-frequency queue information.
在第一方面的另一种可能的实现方式中,网卡预测高频队列信息具体包括:网卡在缓存空间中缓存的队列信息中查找当前被读取的队列信息,将当前被读取的队列信息确定为高频队列信息,和,网卡获取IO命令调度顺序IO命令调度顺序记录了待处理的IO命令;网卡根据IO命令调度顺序,确定待处理的IO命令所属的队列对应的队列信息,将待处理的IO命令所属的队列对应的队列信息确定为高频队列信息。In another possible implementation of the first aspect, the network card predicting the high-frequency queue information specifically includes: the network card searches the queue information currently being read in the queue information cached in the buffer space, and replaces the currently read queue information Determined as the high-frequency queue information, and, the network card obtains the IO command scheduling sequence. The IO command scheduling sequence records the IO commands to be processed; the network card determines the queue information corresponding to the queue to which the IO commands to be processed belongs according to the IO command scheduling sequence. The queue information corresponding to the queue to which the processed IO command belongs is determined to be high-frequency queue information.
在第一方面的另一种可能的实现方式中,网卡预测高频队列信息具体包括:队列信息为队列对上下文QPC,网卡计算缓存空间中缓存的QPC中的读指针和写指针的差值,将读指针和写指针的差值大于预设阈值的QPC确定为高频队列信息,和,网卡获取IO命令调度顺序IO命令调度顺序记录了待处理的IO命令;网卡根据IO命令调度顺序,确定待处理的IO命令所属的队列对应的队列信息,将待处理的IO命令所属的队列对应的队列信息确定为高频队列信息。In another possible implementation of the first aspect, the network card predicts the high-frequency queue information specifically including: the queue information is the queue pair context QPC, and the network card calculates the difference between the read pointer and the write pointer in the QPC cached in the cache space, The QPC where the difference between the read pointer and the write pointer is greater than the preset threshold is determined as high-frequency queue information, and the network card obtains the IO command scheduling sequence. The IO command scheduling sequence records the pending IO commands; the network card determines the IO command scheduling sequence The queue information corresponding to the queue to which the to-be-processed IO command belongs, and the queue information corresponding to the queue to which the to-be-processed IO command belongs is determined as high-frequency queue information.
在第一方面的另一种可能的实现方式中,网卡预测高频队列信息具体包括:队列信息为队列对上下文QPC,网卡计算缓存空间中缓存的QPC中的读指针和写指针的差值,将读指针和写指针的差值大于预设阈值的QPC确定为高频队列信息,和,网卡获取IO 命令调度顺序IO命令调度顺序记录了待处理的IO命令;网卡根据IO命令调度顺序,确定待处理的IO命令所属的队列对应的队列信息,将待处理的IO命令所属的队列对应的队列信息确定为高频队列信息,和,网卡在缓存空间中缓存的队列信息中查找当前被读取的队列信息,将当前被读取的队列信息确定为高频队列信息。In another possible implementation of the first aspect, the network card predicts the high-frequency queue information specifically including: the queue information is the queue pair context QPC, and the network card calculates the difference between the read pointer and the write pointer in the QPC cached in the cache space, The QPC where the difference between the read pointer and the write pointer is greater than the preset threshold is determined as high-frequency queue information, and the network card obtains the IO command scheduling sequence. The IO command scheduling sequence records the pending IO commands; the network card determines the IO command scheduling sequence The queue information corresponding to the queue to which the pending IO command belongs, the queue information corresponding to the queue to which the pending IO command belongs is determined as high-frequency queue information, and the network card searches the queue information cached in the buffer space for the current read The queue information of, determines the queue information currently being read as high-frequency queue information.
在第一方面的另一种可能的实现方式中,所述网卡从所述存储器中读取所述高频队列信息;将所述高频队列信息保存在所述缓存空间中。In another possible implementation manner of the first aspect, the network card reads the high-frequency queue information from the memory; and saves the high-frequency queue information in the buffer space.
上述技术方案中,可以从存储器中获取网卡确定的高频队列信息并保存在网卡的缓存空间中,避免在处理IO命令时去存储器中获取所需的队列信息所造成的较大的处理延时。In the above technical solution, the high-frequency queue information determined by the network card can be obtained from the memory and stored in the cache space of the network card, avoiding the large processing delay caused by obtaining the required queue information from the memory when processing IO commands. .
在第一方面的另一种可能的实现方式中,所述网卡确定所述高频队列信息已经保存在所述缓存空间中;网卡设置缓存空间中的所述高频队列信息的状态信息,所述状态信息用于指示所述高频队列信息继续被保存在所述缓存空间中。In another possible implementation of the first aspect, the network card determines that the high-frequency queue information has been stored in the cache space; the network card sets the state information of the high-frequency queue information in the cache space, so The status information is used to indicate that the high-frequency queue information continues to be stored in the buffer space.
在第一方面的另一种可能的实现方式中,所述状态信息包括优先级信息或锁定信息,其中,优先级信息用于指示所述高频队列信息在所述缓存空间中被更新的优先级,所述锁定信息用于指示所述高频队列信息在所述缓存空间中处于不更新的锁定状态。In another possible implementation manner of the first aspect, the status information includes priority information or lock information, where the priority information is used to indicate the priority of the high-frequency queue information being updated in the buffer space. Level, the locking information is used to indicate that the high-frequency queue information is in a non-updated locked state in the buffer space.
在第一方面的另一种可能的实现方式中,优先级信息或锁定信息可以由状态标志位表示。In another possible implementation manner of the first aspect, the priority information or the lock information may be represented by a status flag bit.
在第一方面的另一种可能的实现方式中,队列信息的状态标志位被置位,则表示该队列信息在缓存空间中处于暂不更新的锁定状态。In another possible implementation manner of the first aspect, the status flag bit of the queue information is set, which indicates that the queue information is in a locked state that is not updated temporarily in the buffer space.
在第一方面的另一种可能的实现方式中,队列信息的优先级信息由多个状态标志位表示,每个状态标志位用于表示一种预测高频队列信息的方法获得的结果,当采用一种预测高频队列信息的方法对一个队列信息进行预测,获得的结果为该队列信息为高频队列信息时,则将该队列信息对应的状态标志位进行置位,结合每个队列信息的多个状态标志位,可以确定队列信息的被更新的优先级。In another possible implementation of the first aspect, the priority information of the queue information is represented by multiple status flag bits, and each status flag bit is used to indicate the result obtained by a method of predicting high-frequency queue information. A method of predicting high-frequency queue information is used to predict a queue information. When the result obtained is that the queue information is high-frequency queue information, the status flag corresponding to the queue information is set, and each queue information is combined The multiple status flags can determine the priority of the queue information to be updated.
在第一方面的另一种可能的实现方式中,队列信息对应的状态标志位被置位的个数越多,该队列信息在缓存空间中被更新的优先级越低。In another possible implementation manner of the first aspect, the more the status flag bits corresponding to the queue information are set, the lower the priority of the queue information being updated in the buffer space.
在第一方面的另一种可能的实现方式中,队列信息包括以下信息中的一种或多种:队列对上下文QPC,完成队列上下文CQC,事件队列上下文EQC。In another possible implementation of the first aspect, the queue information includes one or more of the following information: queue pair context QPC, completion queue context CQC, and event queue context EQC.
在第一方面的一种可能的实现方式中,所述方法还包括:网卡还可以对缓存空间保存的部分或全部队列信息进行更新或替换。In a possible implementation of the first aspect, the method further includes: the network card may also update or replace part or all of the queue information stored in the buffer space.
在第一方面的另一种可能的实现方式中,所述方法还包括:网卡还可以根据优先级信息或锁定信息对缓存空间中存储的部分或全部队列信息进行更新或替换。In another possible implementation manner of the first aspect, the method further includes: the network card may also update or replace part or all of the queue information stored in the buffer space according to the priority information or the lock information.
在第一方面的另一种可能的实现方式中,网卡根据所述缓存空间中的状态信息,将所述缓存空间中的队列信息按等级划分,其中,等级越高的队列信息被访问的可能性越大;优先更新所述缓存空间中存储的等级低的队列信息。In another possible implementation of the first aspect, the network card divides the queue information in the cache space into levels according to the state information in the cache space, wherein the queue information with a higher level may be accessed The higher the performance, the priority is to update the low-level queue information stored in the buffer space.
第二方面,提供了一种芯片,所述芯片应用于服务器系统,所述服务器系统中的本端服务器与远端服务器通过远程直接内存存取RDMA进行数据传输,所述本端服务器的存储器中保存有至少一个队列,每个队列用于保存输入输出IO命令,所述IO命令指示所述本端服务器向所述远端服务器进行数据访问,所述芯片包括:In a second aspect, a chip is provided, the chip is applied to a server system, the local server and the remote server in the server system perform data transmission through remote direct memory access RDMA, and the memory of the local server At least one queue is stored, and each queue is used to store input and output IO commands. The IO commands instruct the local server to access data to the remote server, and the chip includes:
预测单元,用于预测高频队列信息,所述高频队列信息被访问的可能性大于其他队列信息;A prediction unit for predicting high-frequency queue information, which is more likely to be accessed than other queue information;
处理单元,用于在缓存空间中保存所述高频队列信息,其中,所述缓存空间在所述本端服务器的网卡中,所述缓存空间保存的队列信息与所述存储器中的队列一一对应,每个队列信息用于所述网卡对该队列信息对应的队列中的IO命令进行处理。The processing unit is configured to store the high-frequency queue information in a cache space, wherein the cache space is in the network card of the local server, and the queue information stored in the cache space is one-to-one with the queue in the memory Correspondingly, each queue information is used by the network card to process the IO commands in the queue corresponding to the queue information.
在第二方面的一种可能的实现方式中,所述处理单元还用于:对缓存空间保存的部分或全部队列信息进行更新或替换。In a possible implementation manner of the second aspect, the processing unit is further configured to: update or replace part or all of the queue information stored in the buffer space.
在第二方面的另一种可能的实现方式中,所述预测单元具体用于:在所述缓存空间中缓存的队列信息中查找当前被读取的队列信息,将所述当前被读取的队列信息确定为所述高频队列信息。In another possible implementation manner of the second aspect, the prediction unit is specifically configured to: search for the currently read queue information in the queue information cached in the buffer space, and compare the currently read queue information The queue information is determined to be the high-frequency queue information.
在第二方面的另一种可能的实现方式中,所述队列信息为队列对上下文QPC,所述预测单元具体用于:计算所述缓存空间中缓存的QPC中的读指针和写指针的差值,将所述读指针和所述写指针的差值大于预设阈值的QPC确定为所述高频队列信息。In another possible implementation manner of the second aspect, the queue information is the queue pair context QPC, and the prediction unit is specifically configured to: calculate the difference between the read pointer and the write pointer in the QPC buffered in the buffer space Value, the QPC whose difference between the read pointer and the write pointer is greater than a preset threshold is determined as the high-frequency queue information.
在第二方面的另一种可能的实现方式中,所述预测单元具体用于:获取IO命令调度顺序,所述IO命令调度顺序记录了待处理的IO命令;根据所述IO命令调度顺序,确定所述待处理的IO命令所属的队列对应的队列信息,将所述待处理的IO命令所属的队列对应的队列信息确定为所述高频队列信息。In another possible implementation manner of the second aspect, the prediction unit is specifically configured to: obtain an IO command scheduling sequence, the IO command scheduling sequence records the IO commands to be processed; according to the IO command scheduling sequence, The queue information corresponding to the queue to which the to-be-processed IO command belongs is determined, and the queue information corresponding to the queue to which the to-be-processed IO command belongs is determined as the high-frequency queue information.
需要说明的是,本申请中所述网卡还可以根据上述任意两种或三种预测方法预测高频队列信息,并将预测的高频队列信息保存在网卡的缓存空间中。It should be noted that the network card in this application can also predict high-frequency queue information according to any two or three prediction methods described above, and store the predicted high-frequency queue information in the cache space of the network card.
在第二方面的另一种可能的实现方式中,所述处理单元具体用于:从所述存储器中读取所述高频队列信息;将所述高频队列信息保存在所述缓存空间中。In another possible implementation manner of the second aspect, the processing unit is specifically configured to: read the high-frequency queue information from the memory; store the high-frequency queue information in the buffer space .
在第二方面的另一种可能的实现方式中,所述处理单元具体用于:确定所述高频队列信息已经保存在所述缓存空间中;设置所述缓存空间中的所述高频队列信息的状态信息,所述状态信息用于指示所述高频队列信息继续被保存在所述缓存空间中。In another possible implementation manner of the second aspect, the processing unit is specifically configured to: determine that the high-frequency queue information has been stored in the cache space; and set the high-frequency queue in the cache space State information of the information, where the state information is used to indicate that the high-frequency queue information continues to be stored in the buffer space.
在第二方面的另一种可能的实现方式中,所述状态信息包括优先级信息或锁定信息,所述优先级信息用于指示所述高频队列信息在所述缓存空间中被更新的优先级,所述锁定信息用于指示所述高频队列信息在所述缓存空间中处于不更新的锁定状态。In another possible implementation manner of the second aspect, the status information includes priority information or lock information, and the priority information is used to indicate the priority of the high-frequency queue information being updated in the buffer space. Level, the locking information is used to indicate that the high-frequency queue information is in a non-updated locked state in the buffer space.
在第二方面的另一种可能的实现方式中,优先级信息或锁定信息可以由状态标志位表示。In another possible implementation manner of the second aspect, the priority information or the lock information may be represented by a status flag bit.
在第二方面的另一种可能的实现方式中,所述队列信息包括以下信息中的一种或多种:队列对上下文QPC,完成队列上下文CQC,事件队列上下文EQC。In another possible implementation of the second aspect, the queue information includes one or more of the following information: queue pair context QPC, completion queue context CQC, and event queue context EQC.
在第二方面的另一种可能的实现方式中,所述处理单元还用于:根据优先级信息或锁定信息对缓存空间中存储的部分或全部队列信息进行更新或替换。In another possible implementation manner of the second aspect, the processing unit is further configured to: update or replace part or all of the queue information stored in the buffer space according to priority information or lock information.
在第二方面的另一种可能的实现方式中,所述处理单元具体用于:网卡所述缓存空间中的状态信息,将所述缓存空间中的队列信息按等级划分,其中,等级越高的队列信息被访问的可能性越大;优先更新所述缓存空间中存储的等级低的队列信息。In another possible implementation of the second aspect, the processing unit is specifically configured to: state information in the buffer space of the network card, and divide the queue information in the buffer space into levels, where the higher the level The queue information of is more likely to be accessed; priority is given to updating the queue information of low level stored in the buffer space.
第二方面和第二方面的任意一个可能的实现方式的有益效果和第一方面以及第一方面的任意一个可能的实现方式的有益效果是对应的,对此,不再赘述。The beneficial effects of any possible implementation manner of the second aspect and the second aspect correspond to the beneficial effects of the first aspect and any possible implementation manner of the first aspect, and details are not described herein again.
第三方面,提供了一种网卡,包括:如第二方面或第二方面的任意一个可能的实现 方式中的芯片。In a third aspect, a network card is provided, including: the chip in the second aspect or any one of the possible implementation manners of the second aspect.
第四方面,提供了一种服务器,包括存储器和如第三方面中的网卡。In a fourth aspect, a server is provided, including a memory and a network card as in the third aspect.
附图说明Description of the drawings
为了更清楚地说明本申请实施例的技术方法,下面将对实施例中所需使用的附图作以简单地介绍。In order to more clearly illustrate the technical methods of the embodiments of the present application, the following will briefly introduce the drawings needed in the embodiments.
图1是本申请实施例提供的一种可能的服务器系统示意图。Fig. 1 is a schematic diagram of a possible server system provided by an embodiment of the present application.
图2是本申请实施例提供的一种服务器处理IO命令的方法的示意性流程图。Fig. 2 is a schematic flowchart of a method for a server to process an IO command according to an embodiment of the present application.
图3是本申请实施例提供的一种可能的服务器110的示意性结构图。FIG. 3 is a schematic structural diagram of a possible server 110 provided by an embodiment of the present application.
图4是本申请实施例提供的一种网卡上的缓存空间中存储的队列信息的示意性结构图。FIG. 4 is a schematic structural diagram of queue information stored in a buffer space on a network card provided by an embodiment of the present application.
图5是本申请实施例提供的一种更新缓存空间中队列信息的方法的示意性流程图。FIG. 5 is a schematic flowchart of a method for updating queue information in a buffer space provided by an embodiment of the present application.
图6是本申请实施例提供的一种网卡上的缓存空间中划分的QPC优先级示意图。FIG. 6 is a schematic diagram of QPC priorities divided in a buffer space on a network card according to an embodiment of the present application.
图7是本申请实施例提供的一种芯片700的示意性结构图。FIG. 7 is a schematic structural diagram of a chip 700 provided by an embodiment of the present application.
具体实施方式detailed description
下面将结合本申请中的附图,对本申请提供的实施例中的方案进行描述。The solutions in the embodiments provided in this application will be described below in conjunction with the drawings in this application.
为了便于描述,下面先对本申请实施例涉及的几个概念进行说明。For ease of description, several concepts involved in the embodiments of the present application will be described below.
(1)输入输出(input output,IO)命令(1) Input and output (input output, IO) commands
IO命令可以分为读命令和写命令,是指由服务器上运行的应用程序下发的用于指示向远端设备读数据或向远端设备写数据的命令。服务器的处理器可以接收IO命令,并将其存储在存储器中,以使得IO命令等待被处理。具体的,可以将IO命令存储在存储器的队列中。IO commands can be divided into read commands and write commands, which refer to commands issued by an application program running on the server to instruct to read data to or write data to a remote device. The processor of the server can receive the IO command and store it in the memory so that the IO command is waiting to be processed. Specifically, the IO command can be stored in a queue of the memory.
需要说明的是,本申请实施例中提及的IO命令可以理解为待处理的IO命令。IO命令可以由网卡进行处理。It should be noted that the IO commands mentioned in the embodiments of this application can be understood as IO commands to be processed. IO commands can be processed by the network card.
(2)队列(2) Queue
队列是一种特殊的线性表,可以在表的前端(front)进行删除操作,而在表的后端(rear)进行插入操作。进行插入操作的端称为队尾,进行删除操作的端称为队头。队列中没有元素时,称为空队列。队列的数据元素又称为队列元素。在队列中插入一个队列元素称为入队,从队列中删除一个队列元素称为出队。队列可以在一端插入,在另一端删除,队列又可以被称为先进先出(first in first out,FIFO)线性表。A queue is a special linear table. Delete operations can be performed at the front of the table (front) and insert operations can be performed at the back of the table (rear). The end that performs the insertion operation is called the end of the team, and the end that performs the deletion operation is called the head of the team. When there are no elements in the queue, it is called an empty queue. The data elements of the queue are also called queue elements. Inserting a queue element into the queue is called enqueuing, and deleting a queue element from the queue is called dequeuing. The queue can be inserted at one end and deleted at the other end. The queue can also be called a first in first out (FIFO) linear table.
队列的类型可以有多种,例如,发送队列(send queue,SQ),接收队列(receive queue,RQ),完成队列(complete queue,CQ),事件队列(event queue,EQ)。There can be multiple types of queues, for example, send queue (SQ), receive queue (RQ), complete queue (CQ), and event queue (event queue, EQ).
本端服务器的发送队列和对端服务器的接收队列可以称为队列对(queue pair,QP)。The sending queue of the local server and the receiving queue of the opposite server can be called a queue pair (QP).
发送队列可以用于存储待处理的IO命令;接收队列用于存储处理IO命令所需的内存信息。The sending queue can be used to store IO commands to be processed; the receiving queue is used to store memory information required for processing IO commands.
作为一个示例,本端服务器中的发送队列用于存储该本端服务器下发的用于指示向对端服务器读数据或写数据的IO命令,例如,该IO命令为读取对端服务器中存储的数据的读命令,本端服务器中的网卡可以将处理后的读命令发送至对端服务器,该读命令 中可以包括需要读取的对端服务器中存储的数据的地址和长度等,以使得对端服务器可以根据该处理后的读命令,向本端服务器发送其需要读取的数据。As an example, the sending queue in the local server is used to store the IO command issued by the local server to instruct to read or write data to the peer server. For example, the IO command is to read the storage in the peer server. The network card in the local server can send the processed read command to the peer server. The read command can include the address and length of the data stored in the peer server that need to be read, so that The opposite server can send the data it needs to read to the local server according to the processed read command.
又如,该IO命令为向对端服务器中写入数据的写命令,本端服务器中的网卡可以对写命令进行处理之后,将处理后的写命令发送至对端服务器,以使得对端服务器可以根据处理后的写命令查找接收队列中的内存信息,根据查找到的内存信息将处理后的写命令中的数据存储至对端服务器的内存中。For another example, the IO command is a write command to write data to the peer server. After the network card in the local server processes the write command, it sends the processed write command to the peer server, so that the peer server The memory information in the receiving queue can be found according to the processed write command, and the data in the processed write command can be stored in the memory of the opposite server according to the found memory information.
同样的,对端服务器中的发送队列也可以存储该对端服务器下发的用于指示向本端服务器读数据或写数据的IO命令,并通过对端服务器中的网卡发送至本端服务器。具体的请参考上文中的描述,此处不再赘述。Similarly, the sending queue in the opposite server can also store the IO commands issued by the opposite server to instruct to read or write data to the local server, and send it to the local server through the network card in the opposite server. For details, please refer to the above description, which will not be repeated here.
完成队列用于存储完成命令。也就是说,服务器中的网卡对IO命令处理完成之后,可以将完成信息存储在完成队列中,该完成信息也可以称为完成命令。The completion queue is used to store completion commands. In other words, after the network card in the server completes the processing of the IO command, the completion information can be stored in the completion queue, and the completion information can also be referred to as a completion command.
事件队列用于存储事件命令。也就是说,服务器中的网卡在完成队列中存储完成命令后,当完成队列中的完成命令达到一定数量之后,可以产生事件命令。作为示例,事件命令中可以包括:事件类型,完成队列索引。以便于触发处理器对完成队列中存储的一个或多个完成命令进行处理。The event queue is used to store event commands. In other words, after the network card in the server stores the completion command in the completion queue, an event command can be generated when the completion command in the completion queue reaches a certain number. As an example, the event command may include: event type, completion queue index. In order to trigger the processor to process one or more completion commands stored in the completion queue.
应理解,在事件队列中存储事件命令可以避免服务器中的网卡在完成队列中存储一个完成命令后频繁地触发处理器对完成队列中存储的完成命令进行处理。It should be understood that storing event commands in the event queue can prevent the network card in the server from frequently triggering the processor to process the completion commands stored in the completion queue after storing a completion command in the completion queue.
(3)队列信息(3) Queue information
队列的上下文信息也可以称为队列信息,该队列信息与队列一一对应,用于处理该队列信息对应的队列中的IO命令。The context information of the queue may also be referred to as queue information. The queue information corresponds to the queue one-to-one and is used to process the IO commands in the queue corresponding to the queue information.
本申请实施例中可以对在服务器中存储的至少一个队列信息被访问的可能性进行预测,如果某一个队列信息被访问的可能性大于其他队列信息被访问的可能性,该队列信息可以被称为高频队列信息。也就是说,高频队列信息被访问的可能性较大。具体的有关高频队列信息的确定方法请参见下文中描述的方法,此处暂不详述。In the embodiment of the application, the possibility of accessing at least one queue information stored in the server can be predicted. If the possibility of accessing a certain queue information is greater than the possibility of accessing other queue information, the queue information can be called High-frequency queue information. In other words, the high frequency queue information is more likely to be accessed. For specific methods for determining high-frequency queue information, please refer to the method described below, which will not be detailed here.
本申请中,队列信息可以包括以下信息中的一种或多种:队列对上下文(queue pair context,QPC),完成队列上下文(complete queue context,CQC),事件队列上下文(event queue context,EQC)。In this application, queue information may include one or more of the following information: queue pair context (queue pair context, QPC), completion queue context (complete queue context, CQC), event queue context (event queue context, EQC) .
具体的,作为示例。QPC用于服务器中的网卡处理该QPC对应的QP中存储的IO命令,CQC用于处理器对该CQC对应的CQ中存储的完成命令进行处理,EQC用于处理器对该EQC对应的EQ中存储的时间命令进行处理。Specifically, as an example. QPC is used by the network card in the server to process the IO commands stored in the QP corresponding to the QPC, CQC is used by the processor to process the completion commands stored in the CQ corresponding to the CQC, and EQC is used by the processor in the EQ corresponding to the EQC The stored time command is processed.
本申请实施例中,服务器中还可以存储至少一个队列信息中每个队列信息对应的状态信息,该状态信息用于指示与该状态信息对应的队列信息被访问的可能性。In the embodiment of the present application, the server may also store state information corresponding to each queue information in at least one queue information, and the state information is used to indicate the possibility that the queue information corresponding to the state information is accessed.
(4)队列对上下文(queue pair context,QPC)(4) Queue pair context (QPC)
在对发送队列中存储的待处理的IO命令进行处理时,需要根据与QP对应的QPC,对该QP中存储的待处理的IO命令进行权限校验、虚拟地址转换等处理。When processing the to-be-processed IO commands stored in the sending queue, it is necessary to perform authorization verification and virtual address conversion on the to-be-processed IO commands stored in the QP according to the QPC corresponding to the QP.
应理解,QPC是队列对的上下文,与存储待处理的IO命令的QP一一对应。网卡在根据QPC对待处理的IO命令进行处理时,需要根据待处理的IO命令所属的队列确定与该队列相对应的QPC,并根据该QPC对待处理的IO命令进行处理。It should be understood that QPC is the context of the queue pair, and corresponds to the QP storing the IO commands to be processed in a one-to-one correspondence. When the network card processes the IO command to be processed according to the QPC, it needs to determine the QPC corresponding to the queue according to the queue to which the IO command belongs, and process the IO command to be processed according to the QPC.
在数据中心的网络系统中,为了避免网络传输中服务器端数据处理的延迟,可以使 用远程直接数据存取(remote direct memory access,RDMA)技术。应理解,RDMA是将一个设备的内存中存储的数据快速传输至其他设备的内存中,而无需双方操作系统介入的一种内存访问技术。RDMA技术可以适用于高吞吐、低延迟的网络通信,尤其适合在大规模并行计算机集群中使用。In the network system of the data center, in order to avoid the delay of server-side data processing in network transmission, remote direct memory access (RDMA) technology can be used. It should be understood that RDMA is a memory access technology that quickly transfers data stored in the memory of one device to the memory of other devices without the intervention of the operating systems of both parties. RDMA technology can be suitable for high-throughput, low-latency network communication, and is especially suitable for use in large-scale parallel computer clusters.
作为示例,在使用RDMA技术时,通信的本端服务器可以通过网卡将需要传输的数据传输至远端服务器的网卡中,并由该远端服务器的网卡将需要传输的数据传输至远端服务器的内存中。As an example, when using RDMA technology, the local server of communication can transmit the data that needs to be transmitted to the network card of the remote server through the network card, and the network card of the remote server can transmit the data to be transmitted to the remote server. In memory.
下面结合图1,对适用于本申请实施例的一种网络系统进行详细描述。The following describes in detail a network system applicable to the embodiment of the present application with reference to FIG. 1.
图1是本申请实施例提供的一种可能的服务器系统示意图。该服务器系统中可以包括至少两个服务器,图1中以服务器110和服务器120作为示例进行描述。Fig. 1 is a schematic diagram of a possible server system provided by an embodiment of the present application. The server system may include at least two servers. The server 110 and the server 120 are described as examples in FIG. 1.
需要说明的是,除了图1所示的器件外,服务器110以及服务器120中还可以包括通信接口以及作为外存的磁盘等其他器件,在此不做限制。It should be noted that, in addition to the devices shown in FIG. 1, the server 110 and the server 120 may also include other devices such as a communication interface and a magnetic disk as an external memory, which is not limited here.
以服务器110为例。服务器110中可以包括存储器111、处理器112、网卡113。可选地,服务器110还可以包括总线114。其中,存储器111、处理器112以及网卡113可以通过总线114连接。总线114可以是快捷外设部件互连标准(peripheral component interconnect express,PCIE)总线或扩展工业标准结构(extended industry standard architecture,EISA)总线等。所述总线114可以分为地址总线、数据总线、控制总线等。为便于表示,图1中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。Take the server 110 as an example. The server 110 may include a memory 111, a processor 112, and a network card 113. Optionally, the server 110 may further include a bus 114. Among them, the memory 111, the processor 112, and the network card 113 may be connected through the bus 114. The bus 114 may be a peripheral component interconnect express (PCIE) bus or an extended industry standard architecture (EISA) bus. The bus 114 can be divided into an address bus, a data bus, a control bus, and so on. For ease of representation, only one thick line is used in FIG. 1, but it does not mean that there is only one bus or one type of bus.
处理器112是服务器110的运算核心和控制核心(control unit)。处理器112中可以包括多个处理器核(core)。处理器112可以是一块超大规模的集成电路。在处理器112中安装有操作系统和其他软件程序,从而使得处理器112能够实现对存储器111、缓存、磁盘及网卡113的访问。可以理解的是,在本申请实施例中,处理器112中的core例如可以是中央处理器(central processing unit,CPU),还可以是图形处理器(graphics processing unit,GPU)或其他特定集成电路(application specific integrated circuit,ASIC)。The processor 112 is the computing core and control unit of the server 110. The processor 112 may include multiple processor cores (cores). The processor 112 may be a very large scale integrated circuit. An operating system and other software programs are installed in the processor 112, so that the processor 112 can implement access to the memory 111, cache, disk, and network card 113. It can be understood that, in the embodiment of the present application, the core in the processor 112 may be, for example, a central processing unit (CPU), a graphics processing unit (GPU) or other specific integrated circuits. (application specific integrated circuit, ASIC).
应理解,本申请实施例中的处理器112还可以为其他通用处理器、数字信号处理器(digital signal processor,DSP)、专用集成电路(application specific integrated circuit,ASIC)、现成可编程门阵列(field programmable gate array,FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。It should be understood that the processor 112 in the embodiments of the present application may also be other general-purpose processors, digital signal processors (digital signal processors, DSP), application specific integrated circuits (application specific integrated circuits, ASICs), ready-made programmable gate arrays ( field programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
存储器111是服务器110的主存。存储器111通常用来存放操作系统中各种正在运行的软件程序、上层应用下发的输入输出(input output,IO)命令以及与外存交换的信息等。为了提高处理器112的访问速度,存储器111需要具备访问速度快的优点。在一些计算机系统架构中,采用动态随机存取存储器(dynamic random access memory,DRAM)作为存储器111。处理器112能够通过内存控制器(图1中未示出)高速访问存储器111,对存储器111中的任意一个存储单元进行读操作和写操作。The storage 111 is the main storage of the server 110. The memory 111 is generally used to store various running software programs in the operating system, input output (IO) commands issued by upper-level applications, and information exchanged with external memory. In order to increase the access speed of the processor 112, the memory 111 needs to have the advantage of fast access speed. In some computer system architectures, dynamic random access memory (DRAM) is used as the memory 111. The processor 112 can access the memory 111 at a high speed through a memory controller (not shown in FIG. 1), and perform a read operation and a write operation on any storage unit in the memory 111.
还应理解,本申请实施例中的存储器111可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically  EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的随机存取存储器(random access memory,RAM)可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。It should also be understood that the memory 111 in the embodiment of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory. Among them, the non-volatile memory can be read-only memory (ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), and electrically available Erase programmable read-only memory (electrically EPROM, EEPROM) or flash memory. The volatile memory may be random access memory (RAM), which is used as an external cache. By way of exemplary but not restrictive description, many forms of random access memory (RAM) are available, such as static random access memory (static RAM, SRAM), dynamic random access memory (DRAM), and synchronous dynamic random access memory (DRAM). Access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous connection dynamic random access memory Take memory (synchlink DRAM, SLDRAM) and direct memory bus random access memory (direct rambus RAM, DR RAM).
网卡113用于使服务器110与通信网络中的其他服务器进行通讯。网卡可以内置在服务器110中,或者还可以作为服务器110的外接设备,并通过接口与服务器110连接。该接口可以是网络接口(network interface)。例如,PCIE接口。图1中以网卡113内置在服务器110中作为示例进行描述。The network card 113 is used to enable the server 110 to communicate with other servers in the communication network. The network card may be built into the server 110, or may also be used as an external device of the server 110, and connected to the server 110 through an interface. The interface may be a network interface (network interface). For example, PCIE interface. In FIG. 1, the network card 113 is built in the server 110 as an example for description.
对于服务器120而言,可以包括存储器121、处理器122、网卡123。可选地,服务器120还可以包括总线124。服务器120的内部结构可以与服务器110类似,例如:存储器121、处理器122、网卡123分别与前述服务器110中的存储器111、处理器112、网卡113类似,具体的请参考上文对服务器110中各部分的描述,此处不再赘述。For the server 120, it may include a memory 121, a processor 122, and a network card 123. Optionally, the server 120 may further include a bus 124. The internal structure of the server 120 may be similar to that of the server 110, for example: the memory 121, the processor 122, and the network card 123 are respectively similar to the memory 111, the processor 112, and the network card 113 in the aforementioned server 110. For details, please refer to the above description of the server 110. The description of each part will not be repeated here.
在数据处理和通信的场景中,以通信网络中包括服务器110和服务器120作为示例。服务器110和服务器120上分别运行有应用(application,APP),例如,“天气预报”APP。在一个具体的例子中,为了实现高性能的计算,服务器110中的处理器112承担一部分的计算,将计算结果存储至存储器111,服务器120中的处理器122承担另一部分的计算,并将计算结果存储至存储器121。此时需要对存储器111中存储的计算结果以及存储器121中存储的计算结果进行汇总处理,例如,由服务器120中的处理器122对存储器111中存储的计算结果以及存储器121中存储的计算结果进行汇总处理。服务器110中运行的“天气预报”APP会下发IO命令,该IO命令为写命令,用于指示将存储器111中存储的计算结果写入存储器121中。In the scenario of data processing and communication, a communication network including the server 110 and the server 120 is taken as an example. The server 110 and the server 120 respectively run applications (application, APP), for example, the "weather forecast" APP. In a specific example, in order to achieve high-performance computing, the processor 112 in the server 110 is responsible for part of the calculation and stores the calculation result in the memory 111, and the processor 122 in the server 120 is responsible for the other part of the calculation and performs the calculation. The result is stored in the memory 121. At this time, it is necessary to summarize the calculation results stored in the memory 111 and the calculation results stored in the memory 121. For example, the processor 122 in the server 120 performs the calculation results stored in the memory 111 and the calculation results stored in the memory 121. Collective processing. The “weather forecast” APP running in the server 110 will issue an IO command, which is a write command and is used to instruct the calculation result stored in the memory 111 to be written into the memory 121.
服务器110中的处理器112可以将上述IO命令通过总线114发送至存储器111。网卡113可以通过总线114从存储器111中获取上述IO命令,并对上述IO命令进行处理,该IO命令为写命令,网卡113从存储器111中获取写命令指示的需要向存储器121写入的数据。网卡113通过网络向服务器120的网卡123发送该数据。网卡123可以将接收到网卡113发送的数据,并通过总线124将该数据写入存储器121中。网卡123还可以将向存储器121写入数据的处理结果通过网络发送至网卡113,网卡113通过总线114将该结果存储至存储器111,该结果用于表示网卡123已经将处理器112需要向存储器121写入的数据成功存储至存储器121中。The processor 112 in the server 110 may send the above-mentioned IO command to the memory 111 through the bus 114. The network card 113 can obtain the above-mentioned IO command from the memory 111 through the bus 114 and process the above-mentioned IO command. The IO command is a write command. The network card 113 obtains from the memory 111 the data to be written to the memory 121 indicated by the write command. The network card 113 transmits the data to the network card 123 of the server 120 through the network. The network card 123 can receive the data sent by the network card 113 and write the data into the memory 121 via the bus 124. The network card 123 can also send the processing result of writing data to the memory 121 to the network card 113 via the network, and the network card 113 stores the result to the memory 111 via the bus 114. The result is used to indicate that the network card 123 has requested the processor 112 to the memory 121 The written data is successfully stored in the memory 121.
下面结合图2,对服务器110对待处理的IO命令进行处理的实现过程进行描述。The following describes the implementation process of the server 110 processing the IO commands to be processed with reference to FIG. 2.
图2是本申请实施例提供的一种服务器处理IO命令的方法的示意性流程图。如图2所示,该方法可以包括步骤210-240,下面分别对步骤210-240进行详细描述。Fig. 2 is a schematic flowchart of a method for a server to process an IO command according to an embodiment of the present application. As shown in FIG. 2, the method may include steps 210-240, and steps 210-240 will be described in detail below.
步骤210:服务器110中的处理器112将待处理的IO命令发送至存储器111。Step 210: The processor 112 in the server 110 sends the to-be-processed IO command to the memory 111.
具体地,本申请实施例中可以将待处理的IO命令存储至存储器111的发送队列中,该发送队列中可以存储一个或多个待处理的IO命令。Specifically, in the embodiment of the present application, the IO commands to be processed may be stored in the sending queue of the memory 111, and the sending queue may store one or more IO commands to be processed.
IO命令中的信息可以包括但不限于:IO命令所属队列的队列索引,生产者指针(producer index,PI),IO命令相关信息。The information in the IO command may include, but is not limited to: the queue index of the queue to which the IO command belongs, the producer index (PI), and information related to the IO command.
PI表示该待处理的IO命令在队列中的位置。PI也可以理解为该队列中待处理的IO命令的数量。该待处理的IO命令在队列中的排序可以是从队头到队尾从1开始计数,在该QP中增加一个待处理的IO命令,该PI计数加1。PI represents the position of the pending IO command in the queue. PI can also be understood as the number of IO commands to be processed in the queue. The order of the IO commands to be processed in the queue may be counting from the head of the queue to the end of the queue, adding a pending IO command to the QP, and the PI count plus 1.
PI还可以称为写指针(WT-POINTER),由服务器110中下发IO命令的上层应用维护。PI may also be called a write pointer (WT-POINTER), and is maintained by an upper-layer application that issues an IO command in the server 110.
IO命令相关信息可以包括但不限于:权限校验的密钥(key),IO命令的类型。其中,key用于对IO命令的权限进行校验,IO命令的类型例如可以是读命令或写命令等。待处理的IO命令中还可以包括:数据的长度(length),数据的虚拟地址(virtual address)等。The IO command related information may include, but is not limited to: a key for permission verification, and the type of the IO command. Among them, the key is used to verify the authority of the IO command, and the type of the IO command can be, for example, a read command or a write command. The IO command to be processed may also include: the length of the data (length), the virtual address (virtual address) of the data, and so on.
步骤220:处理器112向网卡113发送提示消息。Step 220: The processor 112 sends a prompt message to the network card 113.
处理器112将待处理的IO命令发送至存储器111后,可以向网卡113发送提示消息,该提示消息用于指示存储器111中有待处理的IO命令。作为示例,该提示消息可以为门铃(door bell,DB)。After the processor 112 sends the IO command to be processed to the memory 111, it may send a prompt message to the network card 113, where the prompt message is used to indicate that there is an IO command to be processed in the memory 111. As an example, the prompt message may be a door bell (DB).
在一些实施例中,处理器112向网卡113发送的DB中可以包括:待处理的IO命令所属队列的队列索引,待处理的IO命令在该队列中的位置(例如,PI)。可选地,DB中还可以包括上述待处理的IO命令中包括的IO命令相关信息。In some embodiments, the DB sent by the processor 112 to the network card 113 may include: the queue index of the queue to which the IO command to be processed belongs, and the position (for example, PI) of the IO command to be processed in the queue. Optionally, the DB may also include IO command related information included in the IO command to be processed.
步骤230:网卡113对待处理的IO命令进行处理。Step 230: The network card 113 processes the IO command to be processed.
网卡113可以根据队列信息对待处理的IO命令进行处理。本申请实施例中对待处理的IO命令进行处理时使用到的队列信息可以是以下中的一种或任意多种的组合:队列对上下文(queue pair context,QPC),完成队列上下文(complete queue context,CQC),事件队列上下文(event queue context,EQC)。The network card 113 can process the IO commands to be processed according to the queue information. The queue information used when processing the IO command to be processed in the embodiment of the application may be one or any combination of the following: queue pair context (queue pair context, QPC), complete queue context (complete queue context) , CQC), event queue context (event queue context, EQC).
以队列信息为QPC为例,该QPC与QP一一对应,QP中存储有处理器下发的待处理的IO命令。网卡113根据处理器112下发的提示消息确定发送队列中存储有待处理的IO命令,并根据存储待处理的IO命令的发送队列确定对应的QPC,根据该QPC对待处理的IO命令进行处理。例如,网卡113对待处理的IO命令中的读命令或写命令进行权限校验,或者对该读命令或写命令的虚拟地址转换等。Taking the queue information as QPC as an example, the QPC corresponds to the QP one-to-one, and the QP stores the pending IO commands issued by the processor. The network card 113 determines that the IO command to be processed is stored in the sending queue according to the prompt message issued by the processor 112, determines the corresponding QPC according to the sending queue storing the IO command to be processed, and processes the IO command to be processed according to the QPC. For example, the network card 113 performs permission verification on the read command or the write command in the IO command to be processed, or performs virtual address conversion of the read command or the write command.
以队列信息为CQC为例,CQC与CQ一一对应,CQ中存储有网卡113下发的完成命令。例如,网卡113在处理完发送队列中的IO命令之后,可以将完成命令存储至CQ中。具体的,网卡113可以根据存储完成命令的CQ确定对应的CQC,并根据该CQC中的地址信息确定CQ的地址,以便于网卡113根据CQ的地址,将完成命令存储至CQ中。Taking the queue information as CQC as an example, the CQC corresponds to the CQ one-to-one, and the completion command issued by the network card 113 is stored in the CQ. For example, the network card 113 may store the completed command in the CQ after processing the IO command in the sending queue. Specifically, the network card 113 may determine the corresponding CQC according to the CQ storing the completed command, and determine the address of the CQ according to the address information in the CQC, so that the network card 113 stores the completed command in the CQ according to the address of the CQ.
以队列信息为EQC为例,EQC与EQ一一对应,EQ中存储有网卡113下发的事件命令。例如,网卡113在处理完QP中的IO命令后,可以将完成命令存储在CQ中。并在CQ中的完成命令达到一定数量之后,产生事件命令,网卡113将事件命令存储在EQ中。具体的,网卡113可以根据存储事件命令的EQ确定对应的EQC,并根据该EQC中的地址信息确定EQ的地址,以便于网卡113根据EQ的地址,将事件命令存储至EQ中。Taking the queue information as EQC as an example, the EQC corresponds to the EQ one-to-one, and the event command issued by the network card 113 is stored in the EQ. For example, after the network card 113 has processed the IO command in the QP, it may store the completed command in the CQ. And after the completion command in the CQ reaches a certain number, an event command is generated, and the network card 113 stores the event command in the EQ. Specifically, the network card 113 may determine the corresponding EQC according to the EQ storing the event command, and determine the address of the EQ according to the address information in the EQC, so that the network card 113 can store the event command in the EQ according to the address of the EQ.
下面对QPC的数据结构进行说明。The data structure of QPC is described below.
QPC中可以但不限于包括:PI、消费者指针(consumer index,CI)。其中,CI表示该QPC对应的发送队列中网卡113已经处理的IO命令的数量,也可以称为读指针 (RD-POINTER),由网卡113维护。例如,网卡113处理完一个IO命令,修改存储该IO命令的QP对应的QPC中的CI,该CI计数加1。PI为该QP中待处理的IO命令的数量,有关PI的描述请参见上文中的说明,此处不再赘述。QPC can include, but is not limited to: PI, consumer index (CI). Wherein, CI represents the number of IO commands that the network card 113 has processed in the sending queue corresponding to the QPC, which can also be called a read pointer (RD-POINTER), and is maintained by the network card 113. For example, after the network card 113 has processed an IO command, it modifies the CI in the QPC corresponding to the QP storing the IO command, and the CI count is increased by one. PI is the number of IO commands to be processed in the QP. For the description of PI, please refer to the above description, which will not be repeated here.
QPC中还可以包括:队列状态,密钥(key),队列的物理基地址。其中,网卡113在对待处理的IO命令进行处理时,可以根据队列状态确定待处理的IO命令所属的队列是否可用或是否正常。网卡113还可以根据密钥对待处理的IO命令进行处理时,对待处理的IO命令的权限进行校验。网卡113还可以根据待处理的IO命令所属的队列的物理基地址,对该队列中存储的待处理的IO命令中读命令或写命令的虚拟地址进行转换,得到该待处理的IO命令中读命令或写命令的物理地址。The QPC may also include: queue status, key, and physical base address of the queue. Wherein, when the network card 113 processes the IO command to be processed, it can determine whether the queue to which the IO command to be processed belongs is available or normal according to the queue status. The network card 113 can also verify the authority of the IO command to be processed when processing the IO command to be processed according to the key. The network card 113 can also convert the virtual address of the read command or the write command among the pending IO commands stored in the queue according to the physical base address of the queue to which the pending IO command belongs, to obtain the read command from the pending IO command. The physical address of the command or write command.
可选地,QPC中还可以包括其他相关数据,例如以下中的一种或多种组合:队列在存储器111中的数据长度,信用证,工作模式等。Optionally, the QPC may also include other related data, such as one or more combinations of the following: the data length of the queue in the memory 111, the letter of credit, the working mode, and so on.
网卡113可以根据QPC对待处理的IO命令进行处理。为了便于描述,假设待处理的IO命令存储在队列A中,队列A对应QPC A。例如,网卡113可以根据QPC A中包括的队列状态确定队列A是否可用或是否正常。又如,网卡113可以根据QPC A中包括的密钥对队列A中存储的待处理的IO命令的权限进行校验。又如,网卡113还可以根据QPC A中包括的队列的物理基地址,对队列A中存储的待处理的IO命令中读命令或写命令的虚拟地址进行转换,得到该待处理的IO命令中读命令或写命令的物理地址。The network card 113 can process the IO commands to be processed according to the QPC. For ease of description, assume that the pending IO commands are stored in queue A, and queue A corresponds to QPC A. For example, the network card 113 may determine whether the queue A is available or normal according to the queue status included in the QPC A. For another example, the network card 113 may verify the authority of the IO command to be processed stored in the queue A according to the key included in the QPC A. For another example, the network card 113 can also convert the virtual address of the read command or write command among the pending IO commands stored in the queue A according to the physical base address of the queue included in QPC A, to obtain the pending IO command The physical address of the read command or write command.
下面对CQC的数据结构进行说明。The data structure of CQC is described below.
CQC中可以包括:队列的物理基地址、PI、CI。其中,队列的物理基地址表示CQ在内存中的物理基地址,以便于网卡113根据该物理基地址在CQ中存储完成命令。PI表示CQC对应的CQ中网卡113存储的完成命令的数量。例如,网卡113存储一个完成命令,修改存储该完成命令的CQ对应的CQC中的PI,该PI计数加1。CI表示CQC对应的CQ中处理器已经处理的完成命令的数量。例如,处理器处理一个完成命令,修改存储该完成命令的CQ对应的CQC中的CI,该CI计数加1。The CQC may include: the physical base address, PI, and CI of the queue. The physical base address of the queue indicates the physical base address of the CQ in the memory, so that the network card 113 can store the completion command in the CQ according to the physical base address. PI represents the number of completed commands stored in the network card 113 in the CQ corresponding to the CQC. For example, the network card 113 stores a completion command and modifies the PI in the CQC corresponding to the CQ storing the completion command, and the PI count is increased by one. CI represents the number of completed commands that the processor has processed in the CQ corresponding to the CQC. For example, the processor processes a completion command and modifies the CI in the CQC corresponding to the CQ storing the completion command, and the CI count is increased by one.
下面对EQC的数据结构进行说明。The data structure of EQC is described below.
EQC中可以包括:队列的物理基地址、PI、CI。其中,队列的物理基地址表示EQ在内存中的物理基地址,以便于网卡113根据该物理基地址在EQ中存储事件命令。PI表示EQC对应的EQ中网卡113存储的事件命令的数量。例如,网卡113存储一个事件命令,修改存储该事件命令的EQ对应的EQ中的PI,该PI计数加1。CI表示EQC对应的EQ中处理器已经处理的事件命令的数量。例如,处理器处理一个事件命令,修改存储该事件命令的EQ对应的EQC中的CI,该CI计数加1。The EQC can include: the physical base address of the queue, PI, and CI. Wherein, the physical base address of the queue indicates the physical base address of the EQ in the memory, so that the network card 113 stores the event command in the EQ according to the physical base address. PI represents the number of event commands stored in the network card 113 in the EQ corresponding to the EQC. For example, the network card 113 stores an event command and modifies the PI in the EQ corresponding to the EQ storing the event command, and the PI count is increased by one. CI represents the number of event commands that the processor has processed in the EQ corresponding to the EQC. For example, the processor processes an event command and modifies the CI in the EQC corresponding to the EQ storing the event command, and the CI count is increased by one.
步骤240:网卡113通过网络向服务器120的网卡123发送处理后的IO命令。Step 240: The network card 113 sends the processed IO command to the network card 123 of the server 120 via the network.
上述步骤210-步骤240描述了运行在本端服务器的上层应用发送待处理的IO命令后,本端服务器处理待处理的IO命令的过程。由上述流程可知,网卡需要根据队列信息,对该IO命令进行处理。因此,如何快速地获取对应的队列信息对IO命令的处理速度影响较大。The above steps 210 to 240 describe the process in which the local server processes the pending IO commands after the upper application running on the local server sends the pending IO commands. It can be seen from the above process that the network card needs to process the IO command according to the queue information. Therefore, how to quickly obtain the corresponding queue information has a greater impact on the processing speed of the IO command.
服务器的网卡中还可以包括缓存空间,例如,高速缓冲存储器(缓存空间)。缓存空间可以用于存储部分队列信息。网卡在对待处理的IO命令进行处理时,可以直接从网卡的缓存空间中获取存储的队列信息,并根据该队列信息对待处理的IO命令进行处理,从 而避免网卡频繁通过总线读写存储器中的队列信息。The network card of the server may also include a cache space, for example, a cache memory (cache space). The buffer space can be used to store part of the queue information. When the network card processes the IO commands to be processed, it can directly obtain the stored queue information from the cache space of the network card, and process the IO commands to be processed according to the queue information, thereby avoiding the network card from frequently reading and writing the queue in the memory through the bus information.
由于网卡中缓存空间的规模较小,只能缓存部分队列信息,因此,需要对缓存空间中缓存的队列信息进行更新。但是,由于存储待处理的IO命令的队列具有一定的随机性,一个队列与一个队列信息对应,较难替换出缓存空间中不常用的队列信息,导致缓存空间的命中率降低,进而导致网卡发起不必要的总线的读写访问,增大网卡对待处理的IO命令的处理延迟。Since the size of the cache space in the network card is small, only part of the queue information can be cached, and therefore, the queue information cached in the cache space needs to be updated. However, due to the randomness of the queue storing the IO commands to be processed, one queue corresponds to one queue information, it is difficult to replace the infrequently used queue information in the cache space, resulting in a decrease in the hit rate of the cache space, which in turn causes the network card to initiate Unnecessary bus read and write access increases the processing delay of the IO commands to be processed by the network card.
应理解,一段时间内缓存空间中缓存的被访问到的队列信息与所述缓存空间中所有缓存的比值称为缓存空间的命中率。该比值越大,可以理解为缓存空间的命中率越高。该比值越小,缓存空间的命中率越低。It should be understood that the ratio of the accessed queue information cached in the cache space to all caches in the cache space within a period of time is called the hit rate of the cache space. The larger the ratio, the higher the hit rate of the cache space. The smaller the ratio, the lower the hit rate of the cache space.
本申请实施例提供的技术方案,可以提高网卡中缓存空间的命中率,进而减少由于网卡频繁通过总线读写存储器中存储的队列信息所造成的延时以及总线带宽的浪费,降低网卡对待处理的IO命令的处理延时,提高传输性能。The technical solutions provided by the embodiments of the present application can increase the hit rate of the cache space in the network card, thereby reducing the delay caused by the network card frequently reading and writing queue information stored in the memory through the bus, and the waste of bus bandwidth, and reducing the processing of the network card The processing delay of IO commands improves the transmission performance.
图3是本申请实施例提供的一种可能的服务器110的示意性结构图。如图3所示,服务器110可以包括存储器111、处理器112、网卡113。可选地,服务器110还可以包括总线114。其中,存储器111、处理器112以及网卡113可以通过总线114连接。FIG. 3 is a schematic structural diagram of a possible server 110 provided by an embodiment of the present application. As shown in FIG. 3, the server 110 may include a memory 111, a processor 112, and a network card 113. Optionally, the server 110 may further include a bus 114. Among them, the memory 111, the processor 112, and the network card 113 may be connected through the bus 114.
应理解,网卡113可以在服务器110中,或者还可以作为服务器110的外接设备,并通过接口与服务器110连接。图3中以网卡113在服务器110中为例进行描述。It should be understood that the network card 113 may be in the server 110, or may also be used as an external device of the server 110, and connected to the server 110 through an interface. In FIG. 3, the network card 113 is in the server 110 as an example for description.
存储器111中可以包括多个队列,例如,队列A、队列B,···,队列N。每个队列中可以存储一个或多个命令。以该队列为QP中的发送队列为例,该QP中可以存储一个或多个待处理的IO命令。以该队列为CQ为例,该CQ中可以存储一个或多个完成命令。以该队列为EQ为例,该EQ中可以存储一个或多个事件命令。The memory 111 may include multiple queues, for example, queue A, queue B, ..., queue N. One or more commands can be stored in each queue. Taking the queue as the sending queue in the QP as an example, one or more pending IO commands can be stored in the QP. Taking the queue as a CQ as an example, one or more completion commands can be stored in the CQ. Taking the queue as an EQ as an example, one or more event commands can be stored in the EQ.
网卡113中可以包括:输入处理单元310,缓存空间320,预测单元330,处理单元340。下面分别对上述各个单元进行详细描述。The network card 113 may include: an input processing unit 310, a buffer space 320, a prediction unit 330, and a processing unit 340. Each of the above-mentioned units will be described in detail below.
输入处理单元310:主要用于接收处理器112发送的提示消息(例如,DB),该DB用于指示存储器111的队列中存储有待处理的IO命令。输入处理单元310可以对待处理的IO命令进行处理。具体的,一种可能的实现方式中,输入处理单元310可以从存储器111的队列中获取待处理的IO命令以及该队列对应的QPC,并根据该QPC对待处理的IO命令进行处理。另一种可能的实现方式中,输入处理单元310还可以在对IO命令处理完成之后,可以产生完成命令。并根据存储该完成命令的CQ对应的CQC,对该完成命令进行处理。另一种可能的实现方式中,输入处理单元310还可以在对IO命令处理完成之后,可以产生事件命令。并根据存储该事件命令的EQ对应的EQC,对该事件命令进行处理。具体的处理过程请参考上文中的描述,此处不再赘述。The input processing unit 310 is mainly used to receive a prompt message (for example, a DB) sent by the processor 112, and the DB is used to indicate that there are IO commands to be processed in the queue of the memory 111. The input processing unit 310 may process the IO command to be processed. Specifically, in a possible implementation manner, the input processing unit 310 may obtain the IO command to be processed and the QPC corresponding to the queue from the queue of the memory 111, and process the IO command to be processed according to the QPC. In another possible implementation manner, the input processing unit 310 may also generate a completion command after processing the IO command. And according to the CQC corresponding to the CQ storing the completion command, the completion command is processed. In another possible implementation manner, the input processing unit 310 may also generate an event command after processing the IO command. And according to the EQC corresponding to the EQ storing the event command, the event command is processed. For the specific processing process, please refer to the above description, which will not be repeated here.
缓存空间320:用于存储队列信息,例如,缓存空间320中存储有队列信息A,队列信息B,···,队列信息M。其中,M小于N。队列信息A与队列A对应,用于对队列A中存储的命令进行处理,队列信息B与队列B对应,用于对队列B中存储的命令进行处理,以此类推。Cache space 320: used to store queue information, for example, queue information A, queue information B, ..., queue information M are stored in the cache space 320. Among them, M is less than N. The queue information A corresponds to the queue A and is used to process the commands stored in the queue A, and the queue information B corresponds to the queue B and is used to process the commands stored in the queue B, and so on.
一个队列信息可以包括队列信息条目(entry)以及对应的状态信息。参见图4,缓存空间320中的DATA是用于存储队列信息的队列信息条目的空间,CTRL_DATA用于存储DATA中的队列信息在缓存空间320中的对应的状态信息。例如,如图4所示,队 列信息A可以包括队列信息条目A以及对应的状态信息A。A piece of queue information may include a queue information entry (entry) and corresponding status information. 4, DATA in the buffer space 320 is a space for storing queue information entries of queue information, and CTRL_DATA is used to store corresponding status information of the queue information in the DATA in the buffer space 320. For example, as shown in Figure 4, queue information A may include queue information entry A and corresponding status information A.
状态信息中存放队列信息在缓存空间320中的相关状态信息。该状态信息可以通过标志位来表示,或者也可以是通过字段来表示,本申请对此不做具体限定。The status information stores related status information of the queue information in the buffer space 320. The status information can be represented by a flag bit, or can also be represented by a field, which is not specifically limited in this application.
本申请实施例中队列信息可以包括以下中的一种或多种:QPC,CQC,EQC。The queue information in the embodiment of the present application may include one or more of the following: QPC, CQC, EQC.
预测单元330:主要负责实现对缓存空间320中存储的队列信息后续被访问的可能性进行预测。如果某一个队列信息被访问的可能性大于其他队列信息被访问的可能性,该队列信息可以被称为高频队列信息。The prediction unit 330: is mainly responsible for predicting the possibility that the queue information stored in the buffer space 320 will be subsequently accessed. If a certain queue information is more likely to be accessed than other queue information, the queue information can be called high-frequency queue information.
处理单元340:主要负责在缓存空间中保存预测单元330确定的高频队列信息,还可以根据预测单元330得到的预测结果,对缓存空间320中存储的队列信息进行更新和替换,被替换出的队列信息所占用的存储空间可以用于存储其他新的队列信息。Processing unit 340: Mainly responsible for storing the high-frequency queue information determined by the prediction unit 330 in the buffer space, and can also update and replace the queue information stored in the buffer space 320 according to the prediction result obtained by the prediction unit 330, and the replaced ones The storage space occupied by the queue information can be used to store other new queue information.
应理解,这里的术语“单元”可以通过软件和/或硬件形式实现,对此不作具体限定。例如,“单元”可以是实现上述功能的软件程序、硬件电路或二者结合。当以上任一单元以软件实现的时候,所述软件以计算机程序指令的方式存在,并被存储在网卡的存储器中,网卡的处理器可以用于执行所述程序指令以实现以上方法流程。所述处理器可以包括但不限于以下至少一种:中央处理单元(central processing unit,CPU)、微处理器、数字信号处理器(digital signal processing,DSP)、微控制器(microcontroller unit,MCU)、或人工智能处理器等各类运行软件的计算设备,每种计算设备可包括一个或多个用于执行软件指令以进行运算或处理的核。该处理器可以是个单独的半导体芯片,也可以跟其他电路一起集成为一个半导体芯片,例如,可以跟其他电路(如编解码电路、硬件加速电路或各种总线和接口电路)构成一个片上系统(system on chip,SoC),或者也可以作为一个专用集成电路(application-specific integrated circuit,ASIC)的内置处理器集成在所述ASIC当中,该集成了处理器的ASIC可以单独封装或者也可以跟其他电路封装在一起。该处理器除了包括用于执行软件指令以进行运算或处理的核外,还可进一步包括必要的硬件加速器,如现场可编程门阵列(field programmable gate array,FPGA)、可编程逻辑器件(programmable logic device,PLD)、或者实现专用逻辑运算的逻辑电路。It should be understood that the term "unit" herein can be implemented in the form of software and/or hardware, which is not specifically limited. For example, a "unit" may be a software program, a hardware circuit, or a combination of the two that realize the above-mentioned functions. When any of the above units is implemented by software, the software exists in the form of computer program instructions and is stored in the memory of the network card, and the processor of the network card can be used to execute the program instructions to implement the above method flow. The processor may include, but is not limited to, at least one of the following: central processing unit (CPU), microprocessor, digital signal processing (digital signal processing, DSP), microcontroller (microcontroller unit, MCU) , Or artificial intelligence processors and other computing devices that run software. Each computing device may include one or more cores for executing software instructions for calculation or processing. The processor can be a single semiconductor chip, or it can be integrated with other circuits to form a semiconductor chip. For example, it can be combined with other circuits (such as codec circuits, hardware acceleration circuits, or various bus and interface circuits) to form a system-on-chip ( system on chip, SoC), or as an application-specific integrated circuit (ASIC) built-in processor integrated in the ASIC, the ASIC integrated with the processor can be packaged separately or can be combined with other The circuits are packaged together. In addition to the core used to execute software instructions for calculation or processing, the processor may further include necessary hardware accelerators, such as field programmable gate array (FPGA) and programmable logic device (programmable logic device). device, PLD), or a logic circuit that implements dedicated logic operations.
当以上单元以硬件电路实现的时候,所述硬件电路可能以通用中央处理器(central processing unit,CPU)、微控制器(micro controller unit,MCU)、微处理器(micro processing unit,MPU)、数字信号处理器(digital signal processing,DSP)、片上系统(system on chip,SoC)来实现,当然也可以采用专用集成电路(application-specific integrated circuit,ASIC)实现,或可编程逻辑器件(programmable logic device,PLD)实现,上述PLD可以是复杂程序逻辑器件(complex programmable logical device,CPLD),现场可编程门阵列(field-programmable gate array,FPGA),通用阵列逻辑(generic array logic,GAL)或其任意组合,其可以运行必要的软件或不依赖于软件以执行以上方法流程。When the above unit is implemented by a hardware circuit, the hardware circuit may be a general-purpose central processing unit (central processing unit, CPU), microcontroller (microcontroller unit, MCU), microprocessor (microprocessing unit, MPU), Digital signal processor (digital signal processing, DSP), system on chip (system on chip, SoC) to achieve, of course, it can also be implemented by application-specific integrated circuit (ASIC), or programmable logic device (programmable logic) device, PLD). The above-mentioned PLD can be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (generic array logic, GAL) or its In any combination, it can run necessary software or does not rely on software to execute the above method flow.
下面以图3所示的服务器作为示例,结合图5,对本申请实施例提供的一种网卡的信息处理的方法进行详细描述。In the following, taking the server shown in FIG. 3 as an example, and in conjunction with FIG. 5, a method for information processing of a network card provided in an embodiment of the present application is described in detail.
图5是本申请实施例提供的一种网卡的信息处理的方法的示意性流程图。如图5所示,该方法可以包括步骤510-530,下面分别对步骤510-530进行详细描述。FIG. 5 is a schematic flowchart of a method for information processing of a network card according to an embodiment of the present application. As shown in FIG. 5, the method may include steps 510-530, and steps 510-530 will be described in detail below.
步骤510:预测单元330预测高频队列信息,该高频队列信息被访问的可能性大于其他队列信息。Step 510: The prediction unit 330 predicts high-frequency queue information, which is more likely to be accessed than other queue information.
本申请实施例中,预测单元330可以对缓存空间320中存储的至少一个队列信息被访问的可能性进行预测,将被访问的可能性大于其他队列信息的队列信息确定高频队列信息。In the embodiment of the present application, the prediction unit 330 may predict the probability of at least one queue information stored in the buffer space 320 being accessed, and determine the high-frequency queue information with queue information whose access probability is greater than other queue information.
本申请实施例中缓存空间320中存储的至少一个队列信息可以是以下中的一种或任意多种的组合:QPC,CQC,EQC。具体的请参见上文中的描述,此处不再赘述。The at least one piece of queue information stored in the buffer space 320 in the embodiment of the present application may be one or a combination of any of the following: QPC, CQC, EQC. For details, please refer to the above description, which will not be repeated here.
以队列信息为QPC作为示例。一种可能的实现方式中,预测单元330可以根据QPC是否被输入处理单元310发送的读请求命中,对该QPC后续被访问的可能性进行预测。另一种可能的实现方式中,预测单元330还可以对待处理的IO命令进行预读(例如,获取IO命令调度顺序),并获取待处理的IO命令所属的队列的相关信息,从而根据该队列的相关信息对缓存空间320中存储的至少一个QPC后续被访问的可能性进行预测。另一种可能的实现方式中,预测单元330还可以根据QPC中的读指针(例如,CI)以及写指针(例如,PI)数值的差值,对该QPC后续被访问的可能性进行预测。Take the queue information as QPC as an example. In a possible implementation manner, the prediction unit 330 may predict the possibility that the QPC will be subsequently accessed according to whether the QPC is hit by the read request sent by the input processing unit 310. In another possible implementation manner, the prediction unit 330 may also pre-read the IO commands to be processed (for example, obtain the IO command scheduling sequence), and obtain the relevant information of the queue to which the IO commands to be processed belongs, so as to be based on the queue The related information predicts the possibility that at least one QPC stored in the cache space 320 will be subsequently accessed. In another possible implementation manner, the prediction unit 330 may also predict the possibility that the QPC will be subsequently accessed based on the difference between the values of the read pointer (for example, CI) and the write pointer (for example, PI) in the QPC.
以队列信息为CQC作为示例。预测单元330对至少一个CQC被访问的可能性进行预测的方法与对至少一个QPC被访问的可能性进行预测的方法类似。例如,预测单元330可以根据CQC是否被输入处理单元310发送的读请求命中,对该CQC后续被访问的可能性进行预测。又如,预测单元330还可以对待处理的多个完成命令进行预读(例如,获取IO命令调度顺序),并获取待处理的多个完成命令所属的CQ的相关信息,从而根据该CQ的相关信息对缓存空间320中存储的至少一个CQC后续被访问的可能性进行预测。Take the queue information as CQC as an example. The method of the prediction unit 330 for predicting the possibility of at least one CQC being accessed is similar to the method of predicting the possibility of at least one QPC being accessed. For example, the prediction unit 330 may predict the possibility that the CQC will be subsequently accessed according to whether the CQC is hit by the read request sent by the input processing unit 310. For another example, the prediction unit 330 may also pre-read the multiple completion commands to be processed (for example, obtain the IO command scheduling sequence), and obtain the relevant information of the CQ to which the multiple completion commands to be processed belong, so as to obtain the relevant information according to the CQ. The information predicts the possibility that at least one CQC stored in the cache space 320 will be subsequently accessed.
以队列信息为EQC作为示例。预测单元330对至少一个EQC被访问的可能性进行预测的方法与对至少一个QPC被访问的可能性进行预测的方法类似。例如,预测单元330可以根据EQC是否被输入处理单元310发送的读请求命中,对该EQC后续被访问的可能性进行预测。又如,预测单元330还可以对待处理的多个事件命令进行预读,并获取待处理的多个事件命令所属的EQ的相关信息,从而根据该EQ的相关信息对缓存空间320中存储的至少一个EQC后续被访问的可能性进行预测。Take the queue information as EQC as an example. The method of the prediction unit 330 for predicting the possibility that at least one EQC is accessed is similar to the method for predicting the possibility that at least one QPC is accessed. For example, the prediction unit 330 may predict the possibility that the EQC will be subsequently accessed according to whether the EQC is hit by the read request sent by the input processing unit 310. For another example, the prediction unit 330 may also pre-read the multiple event commands to be processed, and obtain related information about the EQ to which the multiple event commands to be processed belong, so as to check at least the information stored in the buffer space 320 according to the related information of the EQ. The probability of an EQC being visited subsequently is predicted.
下面会结合具体的例子对上述几种可能的实现方式进行详细描述,此处暂不详述。The several possible implementation manners described above will be described in detail below in conjunction with specific examples, which will not be described in detail here.
应理解,预测单元330预测缓存空间320中存储的至少一个队列信息为高频队列信息的方法,可以是根据上述方法中的任意一种进行预测,还可以是根据上述任意两种方法的叠加进行预测,还可以是根据上述任意三种方法的叠加进行预测,本申请对此不做具体限定。It should be understood that the method by which the prediction unit 330 predicts that at least one queue information stored in the buffer space 320 is high-frequency queue information may be predicted according to any one of the foregoing methods, or may be performed based on the superposition of any two of the foregoing methods. The prediction may also be based on the superposition of any of the above three methods, which is not specifically limited in this application.
步骤520:处理单元340在缓存空间中保存所述高频队列信息。Step 520: The processing unit 340 saves the high-frequency queue information in the buffer space.
本申请实施例中,缓存空间保存的队列信息与所述存储器中的队列一一对应,每个队列信息用于所述网卡对所述队列信息对应的队列中的IO命令进行处理。In the embodiment of the present application, the queue information stored in the buffer space corresponds to the queue in the memory one-to-one, and each queue information is used by the network card to process the IO commands in the queue corresponding to the queue information.
作为示例。一种可能的实现方式中,网卡可以从存储器中读取所述高频队列信息,并将该高频队列信息保存在缓存空间中。另一种可能的实现方式中,网卡确定高频队列信息已经保存在所述缓存空间中,并在该缓存空间中设置高频队列信息的状态信息,所述状态信息用于指示高频队列信息继续被保存在所述缓存空间中。As an example. In a possible implementation manner, the network card may read the high-frequency queue information from the memory, and store the high-frequency queue information in the buffer space. In another possible implementation manner, the network card determines that the high-frequency queue information has been stored in the cache space, and sets the state information of the high-frequency queue information in the cache space, and the state information is used to indicate the high-frequency queue information Continue to be stored in the cache space.
本申请实施例中对状态信息不做具体限定,可以是优先级信息或锁定信息。其中,优先级信息用于指示所述高频队列信息在所述缓存空间中被更新的优先级,锁定信息用于指示所述高频队列信息在所述缓存空间中处于不更新的锁定状态。In the embodiments of the present application, the status information is not specifically limited, and may be priority information or lock information. Wherein, the priority information is used to indicate the priority at which the high-frequency queue information is updated in the cache space, and the lock information is used to indicate that the high-frequency queue information is in a non-updated locked state in the cache space.
具体的,处理单元340根据预测结果调整高频队列信息对应的状态信息。预测单元330可以对缓存空间320中存储的至少一个队列信息后续被访问的可能性进行预测,处理单元340设置预测得到的高频队列信息对应的状态信息,高频队列信息是缓存空间中存储的队列信息中的一个或多个,被确定为高频队列信息的队列信息的被访问的概率大于缓存空间中的其他队列信息的被访问的概率。Specifically, the processing unit 340 adjusts the state information corresponding to the high-frequency queue information according to the prediction result. The prediction unit 330 may predict the possibility that at least one queue information stored in the buffer space 320 will be subsequently accessed, and the processing unit 340 sets the state information corresponding to the predicted high-frequency queue information, and the high-frequency queue information is stored in the buffer space. One or more of the queue information is determined to be the high-frequency queue information. The probability of being accessed is greater than the probability of being accessed of other queue information in the buffer space.
具体的实现方式有多种,一种可能的实现方式中,可以设置高频队列信息对应的标志位,例如,对该标志位进行置位操作。另一种可能的实现方式中,还可以修改所述至少一个队列信息中一个或多个队列信息对应的字段。There are many specific implementation manners. In one possible implementation manner, a flag bit corresponding to the high-frequency queue information can be set, for example, a setting operation is performed on the flag bit. In another possible implementation manner, the field corresponding to one or more queue information in the at least one queue information may also be modified.
以设置所述高频队列信息对应的标志位为例。该高频队列信息对应的标志位可以包括以下中的一种或任意多种的组合:有效的(valid),脏的(dirty),锁(lock)等。其中,valid标志位表示队列信息条目是否有效,dirty标志位表示该队列信息条目是否是脏数据,lock标志位表示该队列信息条目是否被锁定。Take the setting of the flag bit corresponding to the high-frequency queue information as an example. The flag bit corresponding to the high-frequency queue information may include one or any combination of the following: valid (valid), dirty (dirty), lock (lock), etc. Among them, the valid flag bit indicates whether the queue information entry is valid, the dirty flag bit indicates whether the queue information entry is dirty data, and the lock flag bit indicates whether the queue information entry is locked.
本申请实施例中lock标志位可以有一个或多个,具体的有关lock标志位的数量,本申请对此不做具体限定。There may be one or more lock flag bits in the embodiment of this application, and the specific number of lock flag bits is not specifically limited in this application.
步骤530:处理单元340根据缓存空间中队列信息对应的状态信息,对缓存空间320中存储的部分或全部队列信息进行更新。Step 530: The processing unit 340 updates part or all of the queue information stored in the buffer space 320 according to the state information corresponding to the queue information in the buffer space.
以队列信息对应的状态信息为优先级信息为例,处理单元340可以根据缓存空间中存储的队列信息的优先级信息,将所述缓存空间中的队列信息按等级划分,其中,等级越高的队列信息被访问的可能性越大;并优先更新缓存空间中存储的等级低的队列信息。Taking the status information corresponding to the queue information as priority information as an example, the processing unit 340 may classify the queue information in the buffer space according to the priority information of the queue information stored in the buffer space. The queue information is more likely to be accessed; and priority is given to updating the low-level queue information stored in the cache space.
以队列信息对应的状态信息为优先级信息为例,处理单元340可以根据优先级信息将所述缓存空间中的队列信息按等级划分,其中,等级越高的队列信息被访问的可能性越大;并优先更新缓存空间中存储的等级低的队列信息。Taking the status information corresponding to the queue information as priority information as an example, the processing unit 340 may divide the queue information in the buffer space into levels according to the priority information, wherein the higher the level, the more likely the queue information to be accessed ; And priority to update the low-level queue information stored in the cache space.
本申请实施例中,可以通过预测网卡的缓存空间中存储的队列信息被访问的可能性,确定高频队列信息,并优化缓存空间中队列信息替换或更新的策略,避免替换掉那些后续会被用到的高频队列信息,从而提高网卡的缓存空间的命中率,减少该网卡产生的总线读写访问次数,减少总线带宽浪费,降低网卡对待处理的IO命令的处理延时,提高传输性能。In the embodiments of the present application, it is possible to determine the high-frequency queue information by predicting the possibility that the queue information stored in the cache space of the network card will be accessed, and optimize the replacement or update strategy of the queue information in the cache space to avoid replacing those that will be subsequently The used high-frequency queue information improves the hit rate of the network card's cache space, reduces the number of bus read and write accesses generated by the network card, reduces the waste of bus bandwidth, reduces the processing delay of the IO commands to be processed by the network card, and improves the transmission performance.
下面以存储在缓存空间的队列信息为QPC作为示例,对前述步骤510和520中对缓存空间中存储的至少一个QPC被访问的可能性进行预测和设置高频队列信息的状态信息的不同实现方式进行详细描述。In the following, the queue information stored in the cache space is QPC as an example, and the possibility of access to at least one QPC stored in the cache space in the foregoing steps 510 and 520 is predicted and different implementations of the state information of the high-frequency queue information are set. Give a detailed description.
一、在一种可能的实现方式中,由于网卡113中的输入处理单元310对缓存空间320中存储的QPC的读写访问是成对出现的,因此,预测单元330可以通过判断缓存空间320中存储的某一个QPC是否被读取,确定后续对该QPC访问的可能性较大,确定该QPC为高频队列信息。也就是说,网卡在所述缓存空间中缓存的QPC中查找当前被读取的QPC,将所述当前被读取的QPC确定为所述高频队列信息。1. In a possible implementation manner, since the read and write access of the input processing unit 310 in the network card 113 to the QPC stored in the cache space 320 occurs in pairs, the prediction unit 330 can determine the cache space 320 Whether a certain stored QPC is read, it is determined that the possibility of subsequent access to the QPC is relatively high, and the QPC is determined to be high-frequency queue information. That is to say, the network card searches the QPC cached in the buffer space for the currently read QPC, and determines the currently read QPC as the high-frequency queue information.
例如,输入处理单元310根据待处理的IO命令所属的队列A确定需要根据QPC A对该待处理的IO命令进行处理,输入处理单元310需要读该QPC A。在该待处理的IO命令处理完之后,需要修改该QPC A中的读指针(例如,CI),因此,后续还需要对该QPC A进行写操作。For example, according to the queue A to which the IO command to be processed belongs, the input processing unit 310 determines that the IO command to be processed needs to be processed according to QPC A, and the input processing unit 310 needs to read the QPC A. After the pending IO command is processed, the read pointer (for example, CI) in the QPC A needs to be modified. Therefore, the QPC A needs to be written subsequently.
对于缓存空间中当前已被读请求命中的QPC,处理单元340可以将这些QPC对应的状态信息进行设置。具体的,作为示例,可以设置QPC对应的标志位。比如,本申请实施例中一个标志位中可以包括锁(lock)1。处理单元340可以将QPC对应的lock 1标志位进行置位,例如,将lock 1标志位设置为1,lock 1标志位为1表示该QPC后续被访问的可能性较大。For the QPCs currently hit by the read request in the cache space, the processing unit 340 may set the state information corresponding to these QPCs. Specifically, as an example, a flag bit corresponding to QPC can be set. For example, a flag bit in the embodiment of the present application may include lock1. The processing unit 340 may set the lock 1 flag bit corresponding to the QPC. For example, setting the lock 1 flag bit to 1, and the lock 1 flag bit to 1 indicates that the QPC is more likely to be accessed subsequently.
可选的,当被读的QPC后续接收到输入处理单元310发送的写访问请求时,处理单元340可以将QPC对应的lock 1标志位清零,例如,将lock 1标志位设置为0,lock1标志位为0表示该QPC后续被访问的可能性较小。Optionally, when the read QPC subsequently receives a write access request sent by the input processing unit 310, the processing unit 340 may clear the lock 1 flag bit corresponding to the QPC, for example, set the lock 1 flag bit to 0, lock1 The flag bit being 0 means that the QPC is less likely to be accessed subsequently.
二、另一种可能的实现方式中,预测单元330还可以获取待处理的IO命令的调度顺序,并根据所述IO命令调度顺序,确定所述待处理的IO命令所属的队列对应的QPC,将所述待处理的IO命令所属的队列对应的QPC确定为所述高频队列信息。应理解,该IO命令的调度顺序记录了待处理的IO命令。也就是说,在待处理的IO命令处理之前,预测单元330可以根据待处理的IO命令的预读结果对缓存空间320中存储的QPC短期被读的可能性进行预测。2. In another possible implementation manner, the prediction unit 330 may also obtain the scheduling sequence of the IO commands to be processed, and determine the QPC corresponding to the queue to which the IO commands to be processed belongs according to the scheduling sequence of the IO commands, The QPC corresponding to the queue to which the to-be-processed IO command belongs is determined as the high-frequency queue information. It should be understood that the scheduling sequence of the IO commands records the IO commands to be processed. That is to say, before the processing of the pending IO command, the prediction unit 330 may predict the possibility that the QPC stored in the buffer space 320 will be read in the short term according to the pre-reading result of the pending IO command.
例如,输入处理单元310接收到处理器112发送的多个提示消息(例如,DB),该多个DB指示服务器110中有多个待处理的IO命令。输入处理单元310可以在该多个待处理的IO命令处理之前,对多个DB进行预读,并将预读的结果发送至预测单元330。例如,输入处理单元310可以根据DB中包括的待处理的IO命令所属队列的队列索引,待处理的IO命令在该队列中的位置(例如,PI)等信息,确定待处理的IO命令所属队列信息。预测单元330可以根据输入处理单元310发送的多个待处理的IO命令所属队列信息确定对应的多个QPC,确定该多个QPC为高频队列信息。处理单元340将该多个QPC对应的状态信息进行设置。具体的,作为示例,可以设置这些QPC对应的标志位。比如,本申请实施例中一个标志位中可以包括锁(lock)2。预测单元330可以将QPC A对应的lock 2标志位进行置位,例如,将lock 2标志位设置为1。For example, the input processing unit 310 receives multiple prompt messages (for example, DBs) sent by the processor 112, and the multiple DBs indicate that there are multiple IO commands to be processed in the server 110. The input processing unit 310 may pre-read multiple DBs before processing the multiple pending IO commands, and send the pre-read results to the prediction unit 330. For example, the input processing unit 310 may determine the queue to which the IO command to be processed belongs according to the queue index of the queue to which the IO command to be processed belongs to, and the position (for example, PI) of the IO command in the queue included in the DB. information. The prediction unit 330 may determine corresponding multiple QPCs according to the queue information to which the multiple pending IO commands sent by the input processing unit 310 belong, and determine that the multiple QPCs are high-frequency queue information. The processing unit 340 sets the state information corresponding to the multiple QPCs. Specifically, as an example, the flag bits corresponding to these QPCs can be set. For example, a flag bit in the embodiment of the present application may include lock 2. The prediction unit 330 may set the lock 2 flag bit corresponding to QPC A, for example, set the lock 2 flag bit to 1.
可选地,在一些实施例中,如果根据上述预读结果确定的多个QPC没有存储在缓存空间320中,网卡可以提前从存储器111获取上述多个QPC,并存储在缓存空间320中。这样可以提前从存储器111中获取述多个QPC,避免在处理IO命令时去存储器111中获取述多个QPC所造成的较大的IO处理延时。Optionally, in some embodiments, if multiple QPCs determined according to the foregoing pre-reading results are not stored in the cache space 320, the network card may obtain the foregoing multiple QPCs from the memory 111 in advance and store them in the cache space 320. In this way, the multiple QPCs can be obtained from the memory 111 in advance, avoiding a large IO processing delay caused by obtaining the multiple QPCs from the memory 111 when processing IO commands.
三、在另一种可能的实现方式中,预测单元330还可以根据读取缓存空间320中存储的QPC的PI,CI,并根据PI和CI之间的差来预测后续对该QPC的读写访问。当读写指针差值大于预设阈值时,说明该QPC后续被访问可能性较大,可以确定该QPC为高频队列信息。3. In another possible implementation manner, the prediction unit 330 may also predict subsequent reads and writes to the QPC based on the PI and CI of the QPC stored in the read buffer space 320, and based on the difference between PI and CI access. When the read-write pointer difference is greater than the preset threshold, it indicates that the QPC is more likely to be accessed subsequently, and it can be determined that the QPC is high-frequency queue information.
应理解,PI表示缓存空间320中存储的QPC对应的队列中的IO命令的数量,该IO命令在队列中的排序可以是从队头到队尾从1开始计数。CI表示该QPC对应的队列中已经处理的IO命令的数量,处理一个IO命令,CI计数加1。因此,如果PI和CI之间的差值较大时,PI越大,CI越小,该队列中存储的待处理的IO命令的数量较大,后续与该队列对应的该QPC后续被访问的概率也较大。It should be understood that PI represents the number of IO commands in the queue corresponding to the QPC stored in the buffer space 320, and the order of the IO commands in the queue may be counted from the head of the queue to the end of the queue. CI represents the number of IO commands processed in the queue corresponding to the QPC. When an IO command is processed, the CI count is increased by 1. Therefore, if the difference between PI and CI is large, the larger the PI and the smaller the CI, the larger the number of pending IO commands stored in the queue, the subsequent QPC corresponding to the queue is subsequently accessed The probability is also greater.
例如,预测单元330可以实时比较QPC中PI和CI之间的差值,当该差值超过某一个预设阈值,处理单元340可以设置该QPC对应的状态信息。具体的,作为示例,可以 设置QPC对应的标志位。比如,本申请实施例中一个标志位中可以包括锁(lock)3。处理单元340可以将QPC A对应的lock 3标志位置位,例如,将lock 3标志位设置为1。For example, the prediction unit 330 may compare the difference between the PI and the CI in the QPC in real time, and when the difference exceeds a certain preset threshold, the processing unit 340 may set the state information corresponding to the QPC. Specifically, as an example, the flag bit corresponding to QPC can be set. For example, a flag bit in the embodiment of the present application may include a lock (lock) 3. The processing unit 340 may set the lock 3 flag corresponding to QPC A, for example, set the lock 3 flag to 1.
可选的,当该QPC中PI和CI之间的差值小于某一个预设阈值,处理单元340可以将该QPC对应的lock 3标志位清零,例如,将lock 3标志位设置为0。Optionally, when the difference between PI and CI in the QPC is less than a certain preset threshold, the processing unit 340 may clear the lock 3 flag bit corresponding to the QPC, for example, set the lock 3 flag bit to 0.
需要说明的是,上述列举的三种预测的方法,可以通过其中的一种或任意两种或三种预测方法的结合确定缓存空间中的高频队列信息。It should be noted that the three prediction methods listed above can be used to determine the high-frequency queue information in the buffer space by one of them or a combination of any two or three prediction methods.
还需要说明的是,以通过设置标志位来实现对状态信息的设置为例。标志位可以设置为一个,也可以设置为多个,标志位的数量的设置和选择的预测方法相关,本申请对此不做具体限定。例如,如果通过其中的一种方法获得预测结果,可以设置一个标志位,例如,一个锁(lock)标志位。又如,如果通过上述任意两种方法的结合获得预测结果,可以设置两个标志位,例如,锁(lock)1标志位和锁(lock)2标志位。又如,如果通过上述三种方法的结合获得预测结果,可以设置三个标志位,例如,锁(lock)1标志位,锁(lock)2标志位,锁(lock)3标志位。It should also be noted that the setting of status information is realized by setting a flag bit as an example. The flag bit can be set to one or multiple. The setting of the number of flag bits is related to the selected prediction method, which is not specifically limited in this application. For example, if the prediction result is obtained by one of these methods, a flag bit, for example, a lock flag bit, can be set. For another example, if the prediction result is obtained through a combination of any of the above two methods, two flag bits can be set, for example, the lock 1 flag and the lock 2 flag. For another example, if the prediction result is obtained through the combination of the above three methods, three flags can be set, for example, lock 1 flag, lock 2 flag, and lock 3 flag.
本申请实施例中,预测单元330对至少一个CQC或EQC被访问的可能性进行预测的方法与对至少一个QPC被访问的可能性进行预测的方法类似。例如,由于网卡113中的输入处理单元310对缓存空间320中存储的CQC或EQC的读写访问是成对出现的,网卡113读取了缓存空间320中的CQC或EQC后,还会修改CQC或EQC中的PI指针。因此,预测单元330可以通过判断缓存空间320中存储的某一个CQC或EQC是否被读取,确定后续对该CQC或EQC访问的可能性较大,处理单元340可以调整该CQC或EQC对应的状态信息。又如,预测单元330还可以根据待处理的完成命令或事件命令的调度顺序,在待处理的完成命令或事件命令处理之前,根据待处理的完成命令或事件命令的预读结果对缓存空间320中存储的CQC或EQC短期被读的可能性进行预测。具体的预测过程与根据预测结果设置状态信息的过程请参考上文中对QPC的预测和状态信息的设置方法,此处不再赘述。In the embodiment of the present application, the method for predicting the probability of at least one CQC or EQC being accessed by the prediction unit 330 is similar to the method for predicting the probability of at least one QPC being accessed. For example, since the input processing unit 310 in the network card 113 has read and write access to the CQC or EQC stored in the cache space 320 in pairs, the network card 113 will modify the CQC after reading the CQC or EQC in the cache space 320. Or the PI pointer in EQC. Therefore, the prediction unit 330 can determine whether a certain CQC or EQC stored in the buffer space 320 is read to determine that the subsequent access to the CQC or EQC is more likely, and the processing unit 340 can adjust the state corresponding to the CQC or EQC. information. For another example, the prediction unit 330 may also perform processing of the pending completion command or event command according to the scheduling sequence of the pending completion command or event command, and compare the buffer space 320 according to the pre-reading result of the pending completion command or event command. The possibility of short-term reading of the CQC or EQC stored in it is predicted. For the specific prediction process and the process of setting status information according to the prediction result, please refer to the QPC prediction and status information setting method mentioned above, which will not be repeated here.
下面以通过上述三种预测方法的结合获得的预测结果,根据预测的结果设置的是至少一个队列信息对应的标志位作为示例。对处理单元340进行队列信息替换的具体实现过程进行详细描述。The following uses the prediction result obtained by the combination of the above three prediction methods, and the flag bit corresponding to at least one queue information is set according to the prediction result as an example. The specific implementation process of the replacement of queue information by the processing unit 340 is described in detail.
为了便于描述,下面以QPC的预测结果为例进行说明。For ease of description, the following uses the QPC prediction result as an example for description.
处理单元340可以根据预测单元330设置的QPC对应的锁标志位,将缓存空间320中存储的至少一个QPC条目分为若干优先级。为了便于描述,图6中以将至少一个QPC条目划分为四个等级为例进行描述。The processing unit 340 may divide the at least one QPC entry stored in the cache space 320 into several priority levels according to the lock flag bit corresponding to the QPC set by the prediction unit 330. For ease of description, FIG. 6 takes the division of at least one QPC entry into four levels as an example for description.
等级1:缓存空间320中短期内较大可能性会被访问的QPC条目,该QPC条目对应的lock1标志位置位。其余lock标志位,例如,lock2标志位,lock3标志位可以为1,或者也可以为0,本申请对此不作具体限定。Level 1: A QPC entry in the cache space 320 that is likely to be accessed in a short period of time, and the lock1 flag corresponding to the QPC entry is set. The other lock flag bits, for example, the lock2 flag bit and the lock3 flag bit may be 1, or may also be 0, which is not specifically limited in this application.
等级2:缓存空间320中短期内较大可能性会被访问的QPC条目,该QPC条目对应的lock 2标志位置位,lock 1标志位未置位。也就是说,该QPC条目对应的lock 2标志位为1,lock 1标志位为0。其余lock标志位,例如,lock 3标志位可以为1,或者也可以为0,本申请对此不作具体限定。Level 2: The QPC entry in the cache space 320 that is likely to be accessed in the short term, the lock 2 flag corresponding to the QPC entry is set, and the lock 1 flag is not set. In other words, the lock 2 flag bit corresponding to the QPC entry is 1, and the lock 1 flag bit is 0. The other lock flag bits, for example, the lock 3 flag bit may be 1, or may also be 0, which is not specifically limited in this application.
等级3:缓存空间320中长期内较大可能性会被访问的QPC条目,该QPC条目对应 的lock 3标志位置位,lock1标志位以及lock 2标志位均未置位。也就是说,该QPC条目对应的lock 3标志位为1,lock1标志位以及lock 2标志位为0。Level 3: QPC entries in the cache space 320 that are likely to be accessed in the long term, the lock 3 flag corresponding to the QPC entry is set, and the lock 1 flag and the lock 2 flag are not set. In other words, the lock 3 flag bit corresponding to the QPC entry is 1, the lock 1 flag bit and the lock 2 flag bit are 0.
等级4:缓存空间320中长期内较小可能性会被访问的QPC条目,该QPC条目对应的lock1标志位、lock2标志位以及lock3标志位均未置位。也就是说,该QPC条目对应的lock1标志位、lock2标志位以及lock3标志位均为0。Level 4: QPC entries in the cache space 320 that are less likely to be accessed for a long time, and the lock1 flag, lock2 flag, and lock3 flag bits corresponding to the QPC entry are not set. In other words, the lock1 flag, lock2 flag, and lock3 flag bits corresponding to the QPC entry are all 0.
参见图6,当缓存空间320中需要缓存新的QPC时,如果缓存空间320中有未被占用的空间(等级5),处理单元340则可以将新的QPC存储在未被占用的空间。如果缓存空间320没有未被占用的空间,则会发生替换,处理换单元340需要将部分QPC删掉,将新的QPC存储在删掉的QPC所占用的存储空间中。Referring to FIG. 6, when a new QPC needs to be cached in the cache space 320, if there is an unoccupied space in the cache space 320 (level 5), the processing unit 340 may store the new QPC in the unoccupied space. If there is no unoccupied space in the cache space 320, replacement will occur, and the processing/changing unit 340 needs to delete part of the QPC and store the new QPC in the storage space occupied by the deleted QPC.
处理单元340在进行替换时依据的优先级从高到低依次是:等级4-等级3-等级2-等级1。也就是说,本申请实施例中处理单元340可以依据锁标志位的含义进行替换。The priority of the processing unit 340 when performing replacement is from high to low: level 4-level 3-level 2-level 1. In other words, the processing unit 340 in the embodiment of the present application can be replaced according to the meaning of the lock flag bit.
作为一个示例,三个锁标志位(lock1标志位、lock2标志位、lock3标志位)都没有置位的QPC,例如,等级4对应的QPC,这些QPC在后续的访问过程中被访问的可能性较低,处理单元340可以优先考虑替换等级4对应的QPC。作为另一个示例,如果没有等级4对应的QPC,处理单元340可以考虑替换等级3对应的QPC,这些QPC在后续会有大量的读写访问,但是短期内这些IO命令还未被调度到,因此,也可以考虑替换等级3对应的QPC。作为另一个示例,如果没有等级3对应的QPC,处理单元340可以考虑替换等级2对应的QPC。作为另一个示例,如果没有等级2对应的QPC,处理单元340最后可以考虑替换等级1对应的QPC。As an example, three lock flags (lock1 flag, lock2 flag, lock3 flag) are not set QPC, for example, the QPC corresponding to level 4, the possibility of these QPCs being accessed in the subsequent access process If it is lower, the processing unit 340 may preferentially consider replacing the QPC corresponding to level 4. As another example, if there is no QPC corresponding to level 4, the processing unit 340 may consider replacing the QPC corresponding to level 3. These QPCs will have a large number of read and write accesses in the future, but these IO commands have not been scheduled in the short term, so , You can also consider replacing the QPC corresponding to level 3. As another example, if there is no QPC corresponding to level 3, the processing unit 340 may consider replacing the QPC corresponding to level 2. As another example, if there is no QPC corresponding to level 2, the processing unit 340 may finally consider replacing the QPC corresponding to level 1.
上述技术方案中,网卡可以提前预测缓存空间中存储的QPC被访问的可能性,从而避免在需要对缓存空间中的QPC进行更新时,替换到后续会用到的QPC,优化缓存空间的替换策略,从而提高网卡的缓存空间的命中率。In the above technical solution, the network card can predict the possibility of accessing the QPC stored in the cache space in advance, thereby avoiding the need to update the QPC in the cache space, replacing it with the QPC that will be used later, and optimizing the replacement strategy of the cache space , Thereby improving the hit rate of the cache space of the network card.
本申请实施例中,处理单元340根据CQC被访问的预测结果或EQC被访问的预测结果,对存储的CQC或EQC进行替换的具体实现过程与上述方法类似,具体的请参考上文中以QPC的预测结果对QPC进行替换的方法,此处不再赘述。In the embodiment of the present application, the processing unit 340 replaces the stored CQC or EQC according to the predicted result of the CQC being accessed or the predicted result of the EQC being accessed, and the specific implementation process of replacing the stored CQC or EQC is similar to the above method. The method of replacing the QPC with the prediction result will not be repeated here.
图7是本申请实施例提供的一种芯片700的示意性结构图,芯片700应用于服务器系统,所述服务器系统中的本端服务器与远端服务器通过远程直接内存存取RDMA进行数据传输,所述本端服务器的存储器中保存有至少一个队列,每个队列用于保存输入输出IO命令,所述IO命令指示所述本端服务器向所述远端服务器进行数据访问,所述芯片700包括:FIG. 7 is a schematic structural diagram of a chip 700 provided by an embodiment of the present application. The chip 700 is applied to a server system. The local server and the remote server in the server system perform data transmission through remote direct memory access RDMA. At least one queue is stored in the memory of the local server, and each queue is used to store input and output IO commands. The IO commands instruct the local server to access data to the remote server. The chip 700 includes :
预测单元330,用于预测高频队列信息,所述高频队列信息被访问的可能性大于其他队列信息;The prediction unit 330 is configured to predict high-frequency queue information, which is more likely to be accessed than other queue information;
处理单元340,用于在缓存空间中保存所述高频队列信息,其中,所述缓存空间在所述本端服务器的网卡中,所述缓存空间保存的队列信息与所述存储器中的队列一一对应,每个队列信息用于所述网卡对该队列信息对应的队列中的IO命令进行处理。The processing unit 340 is configured to store the high-frequency queue information in a cache space, where the cache space is in the network card of the local server, and the queue information stored in the cache space is the same as the queue in the memory. One correspondence, each queue information is used by the network card to process the IO commands in the queue corresponding to the queue information.
可选地,所述处理单元340还用于:对缓存空间保存的部分或全部队列信息进行更新或替换。Optionally, the processing unit 340 is further configured to: update or replace part or all of the queue information stored in the buffer space.
可选地,所述预测单元330具体用于:在所述缓存空间中缓存的队列信息中查找当前被读取的队列信息,将所述当前被读取的队列信息确定为所述高频队列信息。Optionally, the prediction unit 330 is specifically configured to: search for the currently read queue information in the queue information cached in the buffer space, and determine the currently read queue information as the high-frequency queue information.
可选地,所述队列信息为队列对上下文QPC,所述预测单元330具体用于:计算所述缓存空间中缓存的QPC中的读指针和写指针的差值,将所述读指针和所述写指针的差值大于预设阈值的QPC确定为所述高频队列信息。Optionally, the queue information is the queue pair context QPC, and the prediction unit 330 is specifically configured to: calculate the difference between the read pointer and the write pointer in the QPC cached in the buffer space, and compare the read pointer and the write pointer. The QPC whose write pointer difference is greater than the preset threshold is determined as the high-frequency queue information.
可选地,所述预测单元330具体用于:获取IO命令调度顺序,所述IO命令调度顺序记录了待处理的IO命令;根据所述IO命令调度顺序,确定所述待处理的IO命令所属的队列对应的队列信息,将所述待处理的IO命令所属的队列对应的队列信息确定为所述高频队列信息。Optionally, the prediction unit 330 is specifically configured to: obtain the IO command scheduling sequence, the IO command scheduling sequence records the IO commands to be processed; according to the IO command scheduling sequence, determine the IO command to be processed belongs The queue information corresponding to the queue of, and the queue information corresponding to the queue to which the to-be-processed IO command belongs is determined as the high-frequency queue information.
需要说明的是,本申请中所述网卡还可以根据上述任意两种或三种预测方法预测高频队列信息,并将预测的高频队列信息保存在网卡的缓存空间中。It should be noted that the network card in this application can also predict high-frequency queue information according to any two or three prediction methods described above, and store the predicted high-frequency queue information in the cache space of the network card.
可选地,所述处理单元340具体用于:从所述存储器中读取所述高频队列信息;将所述高频队列信息保存在所述缓存空间中。Optionally, the processing unit 340 is specifically configured to: read the high-frequency queue information from the memory; and store the high-frequency queue information in the buffer space.
可选地,所述处理单元340具体用于:确定所述高频队列信息已经保存在所述缓存空间中;设置所述缓存空间中的所述高频队列信息的状态信息,所述状态信息用于指示所述高频队列信息继续被保存在所述缓存空间中。Optionally, the processing unit 340 is specifically configured to: determine that the high-frequency queue information has been stored in the cache space; set the state information of the high-frequency queue information in the cache space, and the state information It is used to indicate that the high-frequency queue information continues to be stored in the buffer space.
可选地,所述状态信息包括优先级信息或锁定信息,所述优先级信息用于指示所述高频队列信息在所述缓存空间中被更新的优先级,所述锁定信息用于指示所述高频队列信息在所述缓存空间中处于不更新的锁定状态。Optionally, the status information includes priority information or lock information, the priority information is used to indicate the priority at which the high-frequency queue information is updated in the buffer space, and the lock information is used to indicate all The high-frequency queue information is in a non-updated locked state in the buffer space.
可选地,优先级信息或锁定信息可以由状态标志位表示。Optionally, priority information or lock information may be represented by status flag bits.
可选地,所述队列信息包括以下信息中的一种或多种:队列对上下文QPC,完成队列上下文CQC,事件队列上下文EQC。Optionally, the queue information includes one or more of the following information: queue pair context QPC, completion queue context CQC, and event queue context EQC.
可选地,所述处理单元340还用于:根据优先级信息或锁定信息对缓存空间中存储的部分或全部队列信息进行更新或替换。Optionally, the processing unit 340 is further configured to: update or replace part or all of the queue information stored in the buffer space according to priority information or lock information.
可选地,所述处理单元340具体用于:网卡所述缓存空间中的状态信息,将所述缓存空间中的队列信息按等级划分,其中,等级越高的队列信息被访问的可能性越大;优先更新所述缓存空间中存储的等级低的队列信息。Optionally, the processing unit 340 is specifically configured to: classify the queue information in the cache space according to the status information in the cache space of the network card, wherein the queue information with a higher level is more likely to be accessed. Large; priority is given to updating the low-level queue information stored in the buffer space.
应理解,在本申请的各种实施例中,上述各过程的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。It should be understood that in the various embodiments of the present application, the size of the sequence number of the above-mentioned processes does not mean the order of execution, and the execution order of each process should be determined by its function and internal logic, and should not correspond to the embodiments of this application. The implementation process constitutes any limitation.
本申请实施例还提供了一种网卡,该网卡包括如上文中描述的任一项所述的芯片700。具体的有关网卡的描述,请参见图3和对网卡113的说明,此处不再赘述。The embodiment of the present application also provides a network card, which includes the chip 700 described in any one of the above. For a specific description of the network card, please refer to Figure 3 and the description of the network card 113, which will not be repeated here.
本申请实施例还提供了一种服务器,该服务器包括:存储器,处理器,网卡等。具体的有关服务器的描述,请参见对图1和图3的说明,此处不再赘述。The embodiment of the present application also provides a server, which includes a memory, a processor, a network card, and the like. For a specific description of the server, please refer to the description of Figure 1 and Figure 3, which will not be repeated here.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。A person of ordinary skill in the art may realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed by hardware or software depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, the specific working process of the system, device and unit described above can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, device, and method may be implemented in other ways. For example, the device embodiments described above are merely illustrative, for example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。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 units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solution of the present application essentially or the part that contributes to the existing technology 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 Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), magnetic disks or optical disks and other media that can store program codes. .
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above are only specific implementations of this application, but the protection scope of this application is not limited to this. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in this application. Should be covered within the scope of protection of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

Claims (18)

  1. 一种网卡的信息处理方法,其特征在于,本端服务器与远端服务器通过远程直接内存存取RDMA进行数据传输,所述本端服务器的存储器中保存有至少一个队列,每个队列用于保存输入输出IO命令,所述IO命令指示所述本端服务器向所述远端服务器进行数据访问,所述方法包括:An information processing method for a network card, which is characterized in that a local server and a remote server perform data transmission through remote direct memory access RDMA, and at least one queue is stored in the memory of the local server, and each queue is used for storing Input and output IO commands, where the IO commands instruct the local server to access data to the remote server, and the method includes:
    所述网卡预测高频队列信息,所述高频队列信息被访问的可能性大于其他队列信息;The network card predicts high-frequency queue information, and the high-frequency queue information is more likely to be accessed than other queue information;
    所述网卡在缓存空间中保存所述高频队列信息,其中,所述缓存空间在所述网卡中,所述缓存空间保存的队列信息与所述存储器中的队列一一对应,每个队列信息用于所述网卡对所述队列信息对应的队列中的IO命令进行处理。The network card stores the high-frequency queue information in a cache space, wherein the cache space is in the network card, and the queue information stored in the cache space corresponds to the queues in the memory one-to-one, and each queue information Used for the network card to process the IO commands in the queue corresponding to the queue information.
  2. 根据权利要求1所述的方法,其特征在于,所述网卡预测高频队列信息包括:The method according to claim 1, wherein the predicting high frequency queue information of the network card comprises:
    所述网卡在所述缓存空间中缓存的队列信息中查找当前被读取的队列信息,将所述当前被读取的队列信息确定为所述高频队列信息。The network card searches for the currently read queue information in the queue information buffered in the buffer space, and determines the currently read queue information as the high frequency queue information.
  3. 根据权利要求1所述的方法,其特征在于,所述队列信息为队列对上下文QPC,所述网卡预测高频队列信息包括:The method according to claim 1, wherein the queue information is a queue pair context QPC, and the network card predicts high frequency queue information comprising:
    所述网卡计算所述缓存空间中缓存的QPC中的读指针和写指针的差值,将所述读指针和所述写指针的差值大于预设阈值的QPC确定为所述高频队列信息。The network card calculates the difference between the read pointer and the write pointer in the QPC cached in the cache space, and determines the QPC whose difference between the read pointer and the write pointer is greater than a preset threshold as the high-frequency queue information .
  4. 根据权利要求1所述的方法,其特征在于,所述网卡预测高频队列信息包括:The method according to claim 1, wherein the predicting high frequency queue information of the network card comprises:
    所述网卡获取IO命令调度顺序,所述IO命令调度顺序记录了待处理的IO命令;The network card obtains the IO command scheduling sequence, and the IO command scheduling sequence records the IO commands to be processed;
    所述网卡根据所述IO命令调度顺序,确定所述待处理的IO命令所属的队列对应的队列信息,将所述待处理的IO命令所属的队列对应的队列信息确定为所述高频队列信息。The network card determines the queue information corresponding to the queue to which the pending IO command belongs according to the IO command scheduling sequence, and determines the queue information corresponding to the queue to which the pending IO command belongs as the high-frequency queue information .
  5. 根据权利要求1-4任一项所述的方法,其特征在于,所述网卡在缓存空间中保存所述高频队列信息,包括:The method according to any one of claims 1 to 4, wherein the storing of the high-frequency queue information in a cache space by the network card comprises:
    所述网卡从所述存储器中读取所述高频队列信息;The network card reads the high-frequency queue information from the memory;
    将所述高频队列信息保存在所述缓存空间中。The high-frequency queue information is stored in the buffer space.
  6. 根据权利要求1-4任一项所述的方法,其特征在于,所述网卡在缓存空间中保存所述高频队列信息,包括:The method according to any one of claims 1 to 4, wherein the storing of the high-frequency queue information in a cache space by the network card comprises:
    所述网卡确定所述高频队列信息已经保存在所述缓存空间中;Determining, by the network card, that the high-frequency queue information has been stored in the buffer space;
    所述网卡设置所述缓存空间中的所述高频队列信息的状态信息,所述状态信息用于指示所述高频队列信息继续被保存在所述缓存空间中。The network card sets the state information of the high-frequency queue information in the cache space, and the state information is used to indicate that the high-frequency queue information continues to be stored in the cache space.
  7. 根据权利要求6所述的方法,其特征在于,所述状态信息包括优先级信息或锁定信息,所述优先级信息用于指示所述高频队列信息在所述缓存空间中被更新的优先级,所述锁定信息用于指示所述高频队列信息在所述缓存空间中处于不更新的锁定状态。The method according to claim 6, wherein the status information includes priority information or lock information, and the priority information is used to indicate the priority of the high-frequency queue information being updated in the buffer space The lock information is used to indicate that the high-frequency queue information is in a non-updated lock state in the buffer space.
  8. 根据权利要求1-7任一项所述的方法,其特征在于,所述队列信息包括以下信息中的一种或多种:队列对上下文QPC,完成队列上下文CQC,事件队列上下文EQC。The method according to any one of claims 1-7, wherein the queue information includes one or more of the following information: queue pair context QPC, completion queue context CQC, and event queue context EQC.
  9. 一种芯片,其特征在于,所述芯片应用于服务器系统,所述服务器系统中的本端服务器与远端服务器通过远程直接内存存取RDMA进行数据传输,所述本端服务器的存储器中保存有至少一个队列,每个队列用于保存输入输出IO命令,所述IO命令指示所 述本端服务器向所述远端服务器进行数据访问,所述芯片包括:A chip, characterized in that the chip is applied to a server system, the local server and the remote server in the server system perform data transmission through remote direct memory access RDMA, and the memory of the local server stores At least one queue, each queue is used to store input and output IO commands, the IO commands instruct the local server to access data to the remote server, and the chip includes:
    预测单元,用于预测高频队列信息,所述高频队列信息被访问的可能性大于其他队列信息;A prediction unit for predicting high-frequency queue information, which is more likely to be accessed than other queue information;
    处理单元,用于在缓存空间中保存所述高频队列信息,其中,所述缓存空间在所述本端服务器的网卡中,所述缓存空间保存的队列信息与所述存储器中的队列一一对应,每个队列信息用于所述网卡对该队列信息对应的队列中的IO命令进行处理。The processing unit is configured to store the high-frequency queue information in a cache space, wherein the cache space is in the network card of the local server, and the queue information stored in the cache space is one-to-one with the queue in the memory Correspondingly, each queue information is used by the network card to process the IO commands in the queue corresponding to the queue information.
  10. 根据权利要求9所述的芯片,其特征在于,所述预测单元具体用于:在所述缓存空间中缓存的队列信息中查找当前被读取的队列信息,将所述当前被读取的队列信息确定为所述高频队列信息。The chip according to claim 9, wherein the prediction unit is specifically configured to: search for the currently read queue information in the queue information buffered in the buffer space, and compare the currently read queue information The information is determined to be the high-frequency queue information.
  11. 根据权利要求9所述的芯片,其特征在于,所述队列信息为队列对上下文QPC,所述预测单元具体用于:计算所述缓存空间中缓存的QPC中的读指针和写指针的差值,将所述读指针和所述写指针的差值大于预设阈值的QPC确定为所述高频队列信息。The chip according to claim 9, wherein the queue information is a queue pair context QPC, and the prediction unit is specifically configured to: calculate the difference between the read pointer and the write pointer in the QPC buffered in the buffer space , Determining a QPC with a difference between the read pointer and the write pointer greater than a preset threshold as the high-frequency queue information.
  12. 根据权利要求9所述的芯片,其特征在于,所述预测单元具体用于:The chip according to claim 9, wherein the prediction unit is specifically configured to:
    获取IO命令调度顺序,所述IO命令调度顺序记录了待处理的IO命令;Acquiring an IO command scheduling sequence, where the IO command scheduling sequence records the IO commands to be processed;
    根据所述IO命令调度顺序,确定所述待处理的IO命令所属的队列对应的队列信息,将所述待处理的IO命令所属的队列对应的队列信息确定为所述高频队列信息。According to the IO command scheduling sequence, the queue information corresponding to the queue to which the to-be-processed IO command belongs is determined, and the queue information corresponding to the queue to which the to-be-processed IO command belongs is determined as the high-frequency queue information.
  13. 根据权利要求9-12任一项所述的芯片,其特征在于,所述处理单元具体用于:The chip according to any one of claims 9-12, wherein the processing unit is specifically configured to:
    从所述存储器中读取所述高频队列信息;Read the high-frequency queue information from the memory;
    将所述高频队列信息保存在所述缓存空间中。The high-frequency queue information is stored in the buffer space.
  14. 根据权利要求9-12任一项所述的芯片,其特征在于,所述处理单元具体用于:The chip according to any one of claims 9-12, wherein the processing unit is specifically configured to:
    确定所述高频队列信息已经保存在所述缓存空间中;Determining that the high-frequency queue information has been stored in the buffer space;
    设置所述缓存空间中的所述高频队列信息的状态信息,所述状态信息用于指示所述高频队列信息继续被保存在所述缓存空间中。The state information of the high-frequency queue information in the buffer space is set, and the state information is used to indicate that the high-frequency queue information continues to be stored in the buffer space.
  15. 根据权利要求14所述的芯片,其特征在于,所述状态信息包括优先级信息或锁定信息,所述优先级信息用于指示所述高频队列信息在所述缓存空间中被更新的优先级,所述锁定信息用于指示所述高频队列信息在所述缓存空间中处于不更新的锁定状态。The chip according to claim 14, wherein the status information includes priority information or lock information, and the priority information is used to indicate the priority of the high-frequency queue information being updated in the cache space The lock information is used to indicate that the high-frequency queue information is in a non-updated lock state in the buffer space.
  16. 根据权利要求9-15任一项所述的芯片,其特征在于,所述队列信息包括以下信息中的一种或多种:队列对上下文QPC,完成队列上下文CQC,事件队列上下文EQC。The chip according to any one of claims 9-15, wherein the queue information includes one or more of the following information: queue pair context QPC, completion queue context CQC, and event queue context EQC.
  17. 一种网卡,其特征在于,包括:如权利要求9至16中任一项所述的芯片。A network card, characterized by comprising: the chip according to any one of claims 9 to 16.
  18. 一种服务器,其特征在于,包括存储器和如权利要求17所述的网卡。A server, characterized by comprising a memory and the network card according to claim 17.
PCT/CN2020/094031 2019-09-06 2020-06-02 Network card information processing method and chip WO2021042782A1 (en)

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN201910843922 2019-09-06
CN201910843922.1 2019-09-06
CN202010073159.1 2020-01-22
CN202010073159.1A CN112463654A (en) 2019-09-06 2020-01-22 Cache implementation method with prediction mechanism

Publications (1)

Publication Number Publication Date
WO2021042782A1 true WO2021042782A1 (en) 2021-03-11

Family

ID=74832776

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/094031 WO2021042782A1 (en) 2019-09-06 2020-06-02 Network card information processing method and chip

Country Status (2)

Country Link
CN (1) CN112463654A (en)
WO (1) WO2021042782A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114024915A (en) * 2021-10-28 2022-02-08 北京锐安科技有限公司 Traffic migration method, device and system, electronic equipment and storage medium
CN117749739A (en) * 2024-02-18 2024-03-22 北京火山引擎科技有限公司 Data transmission method, data reception method, device, equipment and storage medium

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116303173B (en) * 2023-05-19 2023-08-08 深圳云豹智能有限公司 Method, device and system for reducing RDMA engine on-chip cache and chip
CN117112044B (en) * 2023-10-23 2024-02-06 腾讯科技(深圳)有限公司 Instruction processing method, device, equipment and medium based on network card
CN117573602B (en) * 2024-01-16 2024-05-14 珠海星云智联科技有限公司 Method and computer device for remote direct memory access message transmission

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040034718A1 (en) * 2002-08-15 2004-02-19 Dror Goldenberg Prefetching of receive queue descriptors
US7466716B2 (en) * 2004-07-13 2008-12-16 International Business Machines Corporation Reducing latency in a channel adapter by accelerated I/O control block processing
CN103647807A (en) * 2013-11-27 2014-03-19 华为技术有限公司 Information caching method, device and communication apparatus
CN105468494A (en) * 2015-11-19 2016-04-06 上海天玑数据技术有限公司 I/O intensive application identification method
CN105793835A (en) * 2013-12-04 2016-07-20 甲骨文国际公司 System and method for managing and supporting virtual host bus adaptor (vhba) over infiniband (ib) and for supporting efficient buffer usage with a single external memory interface
CN109117270A (en) * 2018-08-01 2019-01-01 湖北微源卓越科技有限公司 The method for improving network packet treatment effeciency

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040034718A1 (en) * 2002-08-15 2004-02-19 Dror Goldenberg Prefetching of receive queue descriptors
US7466716B2 (en) * 2004-07-13 2008-12-16 International Business Machines Corporation Reducing latency in a channel adapter by accelerated I/O control block processing
CN103647807A (en) * 2013-11-27 2014-03-19 华为技术有限公司 Information caching method, device and communication apparatus
CN105793835A (en) * 2013-12-04 2016-07-20 甲骨文国际公司 System and method for managing and supporting virtual host bus adaptor (vhba) over infiniband (ib) and for supporting efficient buffer usage with a single external memory interface
CN105468494A (en) * 2015-11-19 2016-04-06 上海天玑数据技术有限公司 I/O intensive application identification method
CN109117270A (en) * 2018-08-01 2019-01-01 湖北微源卓越科技有限公司 The method for improving network packet treatment effeciency

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114024915A (en) * 2021-10-28 2022-02-08 北京锐安科技有限公司 Traffic migration method, device and system, electronic equipment and storage medium
CN117749739A (en) * 2024-02-18 2024-03-22 北京火山引擎科技有限公司 Data transmission method, data reception method, device, equipment and storage medium
CN117749739B (en) * 2024-02-18 2024-06-04 北京火山引擎科技有限公司 Data transmission method, data reception method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN112463654A (en) 2021-03-09

Similar Documents

Publication Publication Date Title
WO2021042782A1 (en) Network card information processing method and chip
US11755527B2 (en) Techniques for command validation for access to a storage device by a remote client
US11256431B1 (en) Storage system having a field programmable gate array
US10380035B2 (en) Using an access increment number to control a duration during which tracks remain in cache
US10649969B2 (en) Memory efficient persistent key-value store for non-volatile memories
TWI747886B (en) Method for simultaneous kernel mode and user mode access to a device using the nvme interface, non-transitory computer-readable medium and host computer system
US10359954B2 (en) Method and system for implementing byte-alterable write cache
WO2017050014A1 (en) Data storage processing method and device
WO2021036370A1 (en) Method and device for pre-reading file page, and terminal device
US10216437B2 (en) Storage systems and aliased memory
TWI737088B (en) Host-based flash memory maintenance techniques
WO2024051109A1 (en) Data storage method, apparatus and system, device and medium
WO2019101044A1 (en) Method and device for reducing reading latency
EP3115904B1 (en) Method for managing a distributed cache
US20190079795A1 (en) Hardware accelerated data processing operations for storage data
CN106909516A (en) Storage system and its operating method
US20200042368A1 (en) Determining when to send message to a computing node to process items by training a machine learning module
TWI820603B (en) Method for performing access control with aid of multi-phase memory-mapped queue, system-on-chip integrated circuit, memory device, and controller of memory device
US10831662B1 (en) Systems and methods for maintaining cache coherency
US10747596B2 (en) Determining when to send message to a computing node to process items using a machine learning module
WO2023165543A1 (en) Shared cache management method and apparatus, and storage medium
US9058295B2 (en) Encrypt data of storage device
US20230305968A1 (en) Cache replacement policy optimization for producer-consumer flows
WO2024140707A1 (en) Memory allocation method and device
CN117453608A (en) NVMe command processing method, computer equipment, storage medium and product

Legal Events

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

Ref document number: 20861835

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20861835

Country of ref document: EP

Kind code of ref document: A1