Descriptor reordering method and module and data processing unit

By reordering the descriptors in the Virtio system and classifying them into first, middle, and last descriptors, the 'partial packet' problem in MERGEABLE mode is solved, enabling complete reading of the descriptor chain and improving the accuracy of data transmission.

CN120909708AActive Publication Date: 2025-11-07SHENZHEN JAGUAR MICROSYSTEMS CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511424414.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-09-30
Publication Date
2025-11-07
Estimated Expiration
2045-09-30

AI Technical Summary

Technical Problem

The Virtio system encounters a 'partial packet problem' when receiving messages in MERGEABLE mode, causing data transmission errors when the Virtio driver reads the descriptor.

Method used

A descriptor reordering method is proposed, which classifies descriptor types into first descriptor, middle descriptor and tail descriptor, and manages and sorts the output order according to the type, ensuring that the descriptor chain is read by the Virtio driver only after the update is completed.

Benefits of technology

This effectively avoids the 'partial package' phenomenon, ensuring that the Virtio driver fully reads the descriptor chain, thus improving the accuracy and reliability of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120909708A_ABST
    Figure CN120909708A_ABST
Patent Text Reader

Abstract

The invention relates to a descriptor reordering method and module and a data processing unit. The method comprises the steps of obtaining descriptor information of a current descriptor; if the current descriptor is the first descriptor, caching descriptor information of the current descriptor in a first descriptor caching module on the data processing unit side; if the current descriptor is an intermediate descriptor, outputting descriptor information of the current descriptor to a descriptor updating module; if the current descriptor is a tail descriptor and the head descriptor of the corresponding queue is cached, the descriptor information of the current descriptor is firstly output to a descriptor updating module to generate interrupt information, and then the descriptor information of the head descriptor of the queue corresponding to the current descriptor is output to the descriptor updating module to generate interrupt information; according to the message receiving method and the message receiving device, the problem of'half packet 'occurring when the Virtio system receives the message in the MERGEABLE mode can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of Virtio, in particular to a descriptor reordering method and module, a data processing unit and a Virtio system. BACKGROUND

[0002] In the Virtio system, data interaction between a Virtio driver and a Virtio network device is implemented through a virtual queue (Virtqueue). According to the Virtio specification, a Split queue includes a descriptor table (Descriptor Ring), an available ring table (Available Ring) and a used ring table (Used Ring), and a Packed queue combines the descriptor table (Descriptor Ring), the available ring table (Available Ring) and the used ring table (Used Ring) into a descriptor ring table (Descriptor Ring).

[0003] Each descriptor (also referred to as a buffer descriptor, BD for short) in the descriptor ring table (Descriptor Ring) of the Packed queue includes the following fields: a buffer address (Buffer Address), a buffer length (Buffer Length), a buffer ID (Buffer ID) and a flag (Flag). The buffer address points to a block of free buffers, which are used to store messages sent by the Virtio network device. The buffer ID is used to identify or locate the buffer associated with the message, and the buffer ID is used to find the buffer corresponding to the message in the host memory. Compared with the Split queue, the flag (Flag) in the descriptor of the Packed queue is still retained, but its value is increased. Because the descriptor table (Descriptor Ring), the available ring table (Available Ring) and the used ring table (Used Ring) of the Split queue are combined into the descriptor ring table (Descriptor Ring), each descriptor of the Packed queue needs more information to indicate the identity (used or available). Therefore, the Packed queue descriptor increases the VRING_DESC_F_AVAIL flag bit and the VRING_DESC_F_USED flag bit on the basis of the original Flag of the Split queue descriptor, which is used to indicate that the descriptor is available / used.

[0004] As shown in Figure 1 , the packet receiving process of the Packed queue is as follows: The Virtio driver allocates a Buffer for receiving a packet, fills the address, length and ID of the Buffer into a descriptor, and sets the VRING_DESC_F_AVAIL flag and the VRING_DESC_F_USED flag of the descriptor to indicate that the descriptor is available and to inform the Virtio network device; The Virtio network device detects the arrival of a packet and starts the process of receiving a packet. The Virtio network device reads the available descriptor, writes the packet into the Buffer pointed to by the descriptor, and if the Virtio network device and the Virtio driver negotiate successfully the MERGAEGBLE feature, multiple descriptors can be applied when the Buffer pointed to by one descriptor cannot store one packet. After the write operation is completed, the Virtio network device writes the length of the packet stored in the Buffer and the Buffer ID into the descriptor (at this time, the Buffer address does not need to be filled), sets the VRING_DESC_F_AVAIL flag and the VRING_DESC_F_USED flag in the descriptor to indicate that the descriptor is used, and sends an interrupt signal to the Virtio driver to inform the Virtio driver that the packet has been received and stored in the Buffer pointed to by the descriptor; After receiving the interrupt signal, the Virtio driver obtains the length of the packet, the Buffer ID and the flag of the used descriptor, reads the packet from the corresponding Buffer according to the descriptor, and performs corresponding processing, such as analyzing the network packet and updating the application state.

[0005] For the Packed queue, in the MERGEABLE mode, as Figure 2As shown, assuming that receiving a data packet requires using 3 descriptors, the order of use of the 3 descriptors by the Virtio network device is descriptor 0→descriptor 1→descriptor 2, and after each time a message in the data packet is written into a Buffer pointed to by any descriptor, the any descriptor needs to be updated, that is, the Virtio network device writes the message length stored in the Buffer and the Buffer ID into the descriptor, sets the VRING_DESC_F_AVAIL flag and the VRING_DESC_F_USED flag in the descriptor to indicate that the descriptor has been used; at this time, if the Virtio network device updates descriptor 0 and sends an interrupt signal to the Virtio driver, when the Virtio driver reads descriptor 0 in response to the interrupt signal, the Virtio driver will try to read all descriptors of the descriptor chain corresponding to descriptor 0 in order to improve processing efficiency, that is, descriptor 0~2 are read together, but at this time, descriptors 1~2 have not been updated, so the Virtio driver will only read the message in the Buffer corresponding to descriptor 0, and the messages in the Buffers corresponding to descriptors 1~2 are not read, that is, the "half packet problem" in the data transmission scenario occurs, and finally the Virtio driver considers that the read data packet is incorrect. SUMMARY

[0006] The present application aims to provide a descriptor reordering method, a data processing unit, a network processor and a computer program product to solve the "half packet problem" in the MERGEABLE mode of the Virtio system when receiving messages.

[0007] To achieve the above object, according to a first aspect of the present application, a descriptor reordering method is provided, the method comprising: obtaining descriptor information, a queue identifier and a type of a current descriptor; when the type of the current descriptor is a head descriptor, determining a to-be-written storage unit in a head descriptor cache module according to the queue identifier, and caching the descriptor information of the current descriptor to the to-be-written storage unit; the head descriptor cache module comprises a plurality of storage units corresponding to a plurality of queue identifiers one by one, and the head descriptor is the first descriptor used for a data packet; when the type of the current descriptor is a tail descriptor, determining a to-be-read storage unit in the head descriptor cache module according to the queue identifier, if the to-be-read storage unit has valid descriptor information, outputting the descriptor information of the current descriptor to a descriptor updating module first to generate an interrupt information, and then outputting the descriptor information stored in the to-be-read storage unit and the interrupt information to the descriptor updating module; the tail descriptor is the last descriptor used for a data packet, and when only one descriptor is used for a data packet, the type of the one descriptor is a tail descriptor. when the type of the current descriptor is an intermediate descriptor, outputting the descriptor information of the current descriptor to a descriptor updating module; the intermediate descriptor is a descriptor used by a data packet other than the first descriptor and the last descriptor.

[0008] In some embodiments, the method further comprises: when the type of the descriptor is the last descriptor, if there is no valid descriptor information in the to-be-read storage unit, generating an interrupt information, and outputting the descriptor information of the current descriptor and the interrupt information to the descriptor updating module.

[0009] In some embodiments, the descriptor information comprises a length of a packet received by a cache unit pointed by the descriptor and an identification of the cache unit pointed by the descriptor.

[0010] In some embodiments, the method comprises: when writing the descriptor information of the current descriptor to the to-be-written storage unit, also writing a first descriptor valid flag in the to-be-written storage unit as 1; the first descriptor valid flag as 1 indicates that there is valid first descriptor information in the to-be-written storage unit. after outputting the descriptor information stored in the to-be-read storage unit and the interrupt information to the descriptor updating unit, also writing a first descriptor valid flag in the to-be-read storage unit as 0; the first descriptor valid flag as 0 indicates that there is no valid first descriptor information in the to-be-read storage unit.

[0011] According to a second aspect of the present application, a descriptor reordering module is provided, comprising: a descriptor information obtaining unit, configured to obtain descriptor information of a current descriptor, a queue identification and a type; a first sorting unit, configured to, when the type of the current descriptor is a first descriptor, determine a to-be-written storage unit in a first descriptor cache module according to the queue identification, and cache the descriptor information of the current descriptor to the to-be-written storage unit; the first descriptor cache module comprises a plurality of storage units corresponding to a plurality of queue identifications one by one, and the first descriptor is a descriptor first used by a data packet; a second sorting unit, configured to, when the type of the current descriptor is a tail descriptor, determine a storage unit to be read in a head descriptor cache module according to the queue identifier, and if valid descriptor information exists in the storage unit to be read, output descriptor information of the current descriptor to a descriptor updating module first, generate an interrupt information, and then output the descriptor information stored in the storage unit to be read and the interrupt information to the descriptor updating module; the tail descriptor is a descriptor used last in a data packet, and when only one descriptor is used in a data packet, the type of the one descriptor is a tail descriptor; a third sorting unit, configured to, when the type of the current descriptor is a middle descriptor, output descriptor information of the current descriptor to a descriptor updating module; the middle descriptor is a descriptor used in a data packet except the head descriptor and the tail descriptor.

[0012] In some embodiments, the second sorting unit is further configured to, when the type of the descriptor is a tail descriptor, if valid descriptor information does not exist in the storage unit to be read, generate an interrupt information, and output the descriptor information of the current descriptor and the interrupt information to the descriptor updating module.

[0013] In some embodiments, the descriptor information includes a length of a packet received by a cache unit pointed to by the descriptor and an identifier of the cache unit pointed to by the descriptor.

[0014] In some embodiments, the first sorting unit is configured to, when writing the descriptor information of the current descriptor into the storage unit to be written, write a head descriptor valid flag in the storage unit to be written as 1; the head descriptor valid flag being 1 indicates that valid head descriptor information exists in the storage unit to be written. The second sorting unit is configured to, after outputting the descriptor information stored in the storage unit to be read and the interrupt information to the descriptor updating unit, write the head descriptor valid flag in the storage unit to be read as 0; the head descriptor valid flag being 0 indicates that valid head descriptor information does not exist in the storage unit to be read.

[0015] According to a third aspect of the present application, a data processing unit is provided, characterized in that comprising: a packet receiving module, configured to receive a packet; a descriptor reading module, configured to read a current descriptor from a descriptor ring table of a Packed queue; a packet uploading module, configured to write the packet into a cache unit pointed to by the current descriptor; the descriptor reordering module according to the first aspect of the present application; The descriptor updating module is configured to update the descriptor ring table according to the descriptor information output by the descriptor reordering module and send an interrupt notification to the Virtio driver according to the interrupt information output by the descriptor reordering module.

[0016] According to a fourth aspect of the present application, a Virtio system is provided, which comprises a Virtio driver and the data processing unit according to the first aspect of the present application, wherein the Virtio driver is configured to run on a host side and is configured to generate the current descriptor.

[0017] The descriptor reordering method and module, the data processing unit and the Virtio system have the following advantages: The present application provides a descriptor reordering method and module, a data processing unit and a Virtio system, which can solve the "half packet problem" of the Virtio system in the MERGEABLE mode. BRIEF DESCRIPTION OF DRAWINGS

[0018] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0019] Figure 1 The message sending flowchart disclosed in the background art.

[0020] Figure 2 The schematic diagram of sequentially updating descriptors in the background art.

[0021] Figure 3 The flowchart of a descriptor reordering method in the embodiments of the present application.

[0022] Figure 4 The flowchart of the DPU receiving messages in the embodiments of the present application.

[0023] Figure 5 The principle diagram of the intermediate descriptor reordering in the embodiments of the present application.

[0024] Figure 6An example of interleaving descriptor information for different queues to input the FIFO module.

[0025] Figure 7 A structural schematic diagram of a descriptor reordering module in an embodiment of the present application. DETAILED DESCRIPTION

[0026] The detailed description of the drawings is intended as a description of the current embodiments of the present application and is not intended to represent the only forms in which the present application can be constructed or utilized. It is understood that the same or equivalent functions can be accomplished by different embodiments that are intended to be covered by the spirit and scope of the present application.

[0027] Referring to Figure 3 , one embodiment of the present application provides a descriptor reordering method applied to a data processing unit (DPU), and the method comprises: Step S10, obtaining descriptor information, a queue identifier, and a type of a current descriptor; Specifically, as Figure 4 shown is a flowchart of a process in which the DPU receives a packet in the embodiment method, referring to Figure 4 , after receiving a data packet, the DPU temporarily saves the data packet in an internal cache of the DPU, reads a descriptor (Descriptor Ring) from a descriptor ring table of a Packed queue to report the received data packet, and after reading the descriptor, if a length of a Buffer pointed to by the read descriptor is less than a length of the data packet, the data packet is sliced according to the length of the Buffer, the sliced packet is uploaded to the Buffer pointed to by the descriptor, a remaining packet continues to apply for a new descriptor, finally, the packet is written into each Buffer pointed to by the descriptor, and finally, descriptor information of the used descriptor is updated to indicate that the descriptor is used. The embodiment method proposes a descriptor reordering method for a descriptor updating task, to avoid a "half packet problem" in reading a descriptor / packet by a Virtio driver after updating the descriptor, as Figure 5 shown is a principle diagram of the embodiment method, referring to Figure 5The descriptor information, queue id (qid), and type of all used descriptors are sent to a FIFO module, which follows the first-in first-out principle, i.e., the descriptor information that enters the FIFO module first is output first. The FIFO module can function as a buffer and process the descriptor information in sequence. Step S10 of the embodiment method acquires the descriptor information of the current descriptor output by the FIFO module. The descriptor type includes a head descriptor, an intermediate descriptor, or a tail descriptor. The head descriptor refers to the first descriptor used to store a data packet. The Buffer pointed to by the head descriptor stores the start portion of the packet. The tail descriptor refers to the last descriptor used to store a data packet. The Buffer pointed to by the tail descriptor stores the end portion of the packet. The intermediate descriptor is a descriptor used to store a data packet other than the head descriptor and the tail descriptor. The Buffer pointed to by the intermediate descriptor stores the middle portion of the packet. The head descriptor, the intermediate descriptor, and the tail descriptor corresponding to a data packet enter the FIFO module in sequence.

[0028] Step S20: When the type of the current descriptor is the head descriptor, a to-be-written storage unit in a head descriptor cache module is determined according to the queue id, and the descriptor information of the current descriptor is cached to the to-be-written storage unit. The head descriptor cache module includes a plurality of storage units corresponding to a plurality of queue ids one by one. The head descriptor is the first descriptor used for a data packet. Specifically, the head descriptor cache module is in the form of a RAM (Random Access Memory). Taking queue Q1 as an example, when the descriptor information of the head descriptor BD0 of queue Q1 is acquired, the descriptor information of the head descriptor BD0 is not immediately output, but is temporarily cached in the head descriptor cache module of the DPU. Then, after the descriptor information of other descriptors of queue Q1 is output, the descriptor information of the head descriptor BD0 is output, so as to ensure that the information of all descriptors of the entire descriptor chain is updated by the Vitrio device when the Virtio driver reads the descriptor chain.

[0029] Step S30, when the type of the current descriptor is a tail descriptor, determining a storage unit to be read in the head descriptor cache module according to the queue identifier, if there is valid descriptor information in the storage unit to be read, outputting the descriptor information of the current descriptor to the descriptor update module first, generating an interrupt information, and then outputting the descriptor information stored in the storage unit to be read and the interrupt information to the descriptor update module; the tail descriptor is a descriptor used last in a data packet, when a data packet uses only one descriptor, the type of the one descriptor is a tail descriptor; Specifically, the descriptor update module is a module of the DPU, used to generate a new descriptor according to the message length of the descriptor and the cache unit ID, and write the new descriptor into a corresponding position in the descriptor ring table to complete descriptor update (modify the state of the descriptor from available to used), and send an interrupt signal to the Virtio driver to inform the Virtio driver that the descriptor / message can be read.

[0030] Taking the data packet reception of the queue Q1 as an example, when the descriptor information of the tail descriptor BD2 of the queue Q1 and the queue identifier are acquired, whether there is valid descriptor information in the storage unit corresponding to the queue Q1 (queue identifier) in the head descriptor cache module is queried according to the queue identifier of the tail descriptor BD2, if there is valid descriptor information, the descriptor information of the tail descriptor BD2 is output to the descriptor update module first, an interrupt information is generated, and then the interrupt information and the descriptor information of the head descriptor BD0 of the queue Q1 stored in the head descriptor cache module are output to the descriptor update module together, the interrupt information is used to inform the descriptor update module to send an interrupt signal to the Virtio driver, the descriptor update module updates the tail descriptor BD2 and the head descriptor BD0 in order according to the descriptor information of the tail descriptor BD2 and the head descriptor BD0, and the descriptor information of the middle descriptor BD1 of the queue Q1 has been output before the tail descriptor is received, so that the descriptor reorder update of BD0, BD1 and BD2 of the queue Q1 is realized, and then an interrupt signal is sent to the Virtio driver according to the interrupt information, so as to ensure that when the Virtio driver reads all the descriptors (BD0~2) of the descriptor chain after the head descriptor BD0 is updated, the descriptors BD0~2 have all been updated to used.

[0031] Step S40, when the type of the current descriptor is a middle descriptor, outputting the descriptor information of the current descriptor to the descriptor update module; the middle descriptor is a descriptor used by a data packet except the head descriptor and the tail descriptor.

[0032] Specifically, in this embodiment, after the descriptor update module updates the descriptors in the descriptor ring table according to the message length and cache unit ID of the intermediate descriptor, it will not send an interrupt message to the Virtio driver, because the message length and cache unit ID of the first descriptor have not yet been updated.

[0033] In traditional Virtio, an interrupt signal needs to be sent to the Virtio driver for each descriptor update. However, the method in this embodiment proposes to merge and output the interrupts of multiple descriptor update events of the same descriptor chain. In this embodiment, for each packet, the first descriptor of the descriptor chain corresponding to the packet is the last to be updated. Therefore, when the descriptor information of the first descriptor is output to the descriptor update module, an interrupt message is also carried to trigger the descriptor update module to send an interrupt signal to the Virtio driver after updating the corresponding descriptor in the descriptor ring table according to the descriptor information of the first descriptor.

[0034] like Figure 6 The image shows an example of interleaving descriptor information from different queues into the FIFO module. This embodiment's method can be applied to... Figure 6 In scenarios where descriptor information from different queues is interleaved, the method in this embodiment stores the descriptor information of the first descriptor of each queue separately. For each queue's descriptor, the descriptor information of the first descriptor is always the last output of the corresponding queue to the descriptor update module. This ensures that before updating the first descriptor corresponding to each packet in each queue, its tail descriptor and middle descriptor have been updated, avoiding the "half-packet problem". In addition, descriptors from different queues will not affect each other, allowing interleaved input from the front-end module and saving buffer space.

[0035] As described in the above embodiments, the method of this embodiment addresses the "partial packet problem" that occurs when the Virtio system receives packets in MERGEABLE mode. It proposes to reorder and update descriptors. Each descriptor used in a data packet is classified as a first descriptor, middle descriptor, or tail descriptor according to the order of use. The Data Processing Unit (DPU) manages the descriptors and sorts the output order according to the descriptor type. This ensures that when the Virtio driver reads the descriptor chain, it will only read the entire descriptor chain completely at once after all descriptors in the entire descriptor chain have been updated by the Data Processing Unit (DPU), thereby avoiding the "partial packet" phenomenon.

[0036] In some embodiments, the method further includes: When the descriptor type is a tail descriptor, if there is no valid descriptor information in the to-be-read storage unit, an interrupt information is generated, and the descriptor information of the current descriptor and the interrupt information are output to a descriptor update module.

[0037] Specifically, if one Buffer is used to receive one data packet, the descriptor corresponding to the Buffer is a head descriptor and a tail descriptor. In the embodiment, in order to simplify the DPU processing logic, the tail descriptor is classified as a tail descriptor, and the tail descriptor is directly output to the descriptor update module. It can be understood that, for the tail descriptor, there is no head descriptor, and therefore there is no valid descriptor information in the storage unit corresponding to the queue identifier.

[0038] In some embodiments, the descriptor information includes a length of a packet received by a Buffer pointed to by the descriptor and an identifier (Buffer ID) of the Buffer pointed to by the descriptor.

[0039] In some embodiments, the method comprises: When the descriptor information of the current descriptor is written into the to-be-written storage unit, a head descriptor valid flag in the to-be-written storage unit is also written as 1. The head descriptor valid flag being 1 indicates that there is valid head descriptor information in the to-be-written storage unit. After the descriptor information stored in the to-be-read storage unit and the interrupt information are output to the descriptor update module, the head descriptor valid flag in the to-be-read storage unit is also written as 0. The head descriptor valid flag being 0 indicates that there is no valid head descriptor information in the to-be-read storage unit.

[0040] Specifically, each storage unit in the head descriptor cache module uses a queue identifier (QID) of a queue corresponding to the storage unit as an index for addressing the storage unit. The number of storage units in the head descriptor cache module depends on the number of queues. Each storage unit is used to store descriptor information of one head descriptor and a valid flag. By querying the head descriptor valid flag of the storage unit, it can be quickly determined whether there is valid head descriptor information in the storage unit. In addition, the setting of the head descriptor valid flag can simplify the logic. After the head descriptor information is output, the head descriptor information in the storage unit does not need to be emptied. Instead, the head descriptor valid flag in the storage unit is only rewritten as 0. The descriptor information of a head descriptor of a next packet received subsequently can be written to overwrite the original information in the corresponding field of the storage unit. Then, the head descriptor valid flag is set to 1 to indicate that the newly written head descriptor information is valid.

[0041] Corresponding to the method of the above embodiment, another embodiment of the present application provides a descriptor reordering module, comprising: a descriptor information obtaining unit, configured to obtain descriptor information, a queue identifier, and a type of a current descriptor; a first sorting unit, configured to, when the type of the current descriptor is a head descriptor, determine a to-be-written storage unit in a head descriptor cache module according to the queue identifier, and cache the descriptor information of the current descriptor to the to-be-written storage unit; the head descriptor cache module comprises a plurality of storage units corresponding to a plurality of queue identifiers one by one, and the head descriptor is a first descriptor used by a data packet; a second sorting unit, configured to, when the type of the current descriptor is a tail descriptor, determine a to-be-read storage unit in the head descriptor cache module according to the queue identifier, and if the to-be-read storage unit has valid descriptor information, output the descriptor information of the current descriptor to a descriptor updating module first, generate an interrupt information, and then output the descriptor information stored in the to-be-read storage unit and the interrupt information to the descriptor updating module; the tail descriptor is a last descriptor used by a data packet, and when a data packet uses only one descriptor, the type of the one descriptor is a tail descriptor; a third sorting unit, configured to, when the type of the current descriptor is a middle descriptor, output the descriptor information of the current descriptor to the descriptor updating module; the middle descriptor is a descriptor used by a data packet except the head descriptor and the tail descriptor.

[0042] In some embodiments, the second sorting unit is further configured to, when the type of the descriptor is a tail descriptor, if the to-be-read storage unit does not have valid descriptor information, generate an interrupt information, and output the descriptor information of the current descriptor and the interrupt information to the descriptor updating module.

[0043] In some embodiments, the descriptor information comprises a length of a packet received by a buffer unit pointed to by the descriptor and an identifier of the buffer unit.

[0044] In some embodiments, the first sorting unit is configured to, when writing the descriptor information of the current descriptor to the to-be-written storage unit, write a head descriptor valid flag bit in the to-be-written storage unit to 1; the head descriptor valid flag bit being 1 indicates that the to-be-written storage unit has valid head descriptor information. The second sorting unit is configured to, after outputting the descriptor information stored in the to-be-read storage unit and the interrupt information to the descriptor updating unit, write a head descriptor valid flag bit in the to-be-read storage unit to 0; the head descriptor valid flag bit being 0 indicates that the to-be-read storage unit does not have valid head descriptor information.

[0045] It should be noted that the descriptor reordering module of the embodiment corresponds to the method of the above embodiment, and the unexplained contents of the descriptor reordering module of the embodiment can be obtained by referring to the contents of the method of the above embodiment. The descriptor reordering module of the embodiment will not be described again.

[0046] Another embodiment of the present application also provides a data processing unit (DPU), comprising: a packet receiving module, configured to receive a packet; a descriptor reading module, configured to read a current descriptor from a descriptor ring table of a Packed queue; a packet uploading module, configured to write the packet into a cache unit pointed by the current descriptor; a descriptor reordering module as described in the first aspect of the present application; a descriptor updating module, configured to update the descriptor ring table according to the length of the packet and the ID of the cache unit output by the descriptor reordering module, and send an interrupt notification to a Virtio driver according to the interrupt information output by the descriptor reordering module.

[0047] Another embodiment of the present application provides a data processing unit (DPU), comprising: a communication interface, configured to communicate with other electronic devices; a memory, configured to store computer program instructions; a processor, configured to execute the computer program instructions to support the data processing unit (DPU) to implement the method according to the above embodiment.

[0048] In the embodiment, the memory mainly includes a program storage area and a data storage area, wherein the program storage area can store application programs required by at least one function of the operation device, and the data storage area can store related data. In addition, the memory can be a high-speed random access memory, and can also be a non-volatile memory such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card and a flash card, or the memory can also be other volatile solid-state storage devices.

[0049] The processor can be a central processing unit (CPU), and can also be other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components, etc. The general-purpose processor can be a microprocessor, or the processor can also be any conventional processor. The processor is a control center of the data processing unit, and connects various parts of the data processing unit through various interfaces and lines.

[0050] Another embodiment of the present application provides a network processor, comprising a Virtio driver running on a host side and the data processing unit (DPU) described in the above embodiments, wherein the Virtio driver is used at least for generating the descriptor.

[0051] Another embodiment of the present application provides a computer program product, comprising computer program instructions for instructing a computer device to perform operations corresponding to the descriptor ring table updating described in the above embodiments.

[0052] Specifically, the computer program product comprises a series of computer program instructions, which are codes written in computer programs and define how to perform specific operations. The computer program instructions are designed to be loaded onto a computer device and guide the device to perform specific operations, which refer to each step in the descriptor ring table updating described in the above embodiments. In this way, the computer program product of the present embodiment provides a complete software solution, which can be run on various computer devices to implement the descriptor ring table updating of the above embodiments.

[0053] The above has described the embodiments of the present application, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes are obvious to those skilled in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other ordinary skilled persons in the art to understand the embodiments disclosed herein.

Claims

1. A descriptor reordering method characterized by, The method comprises: obtaining descriptor information, queue identification and type of a current descriptor; when the type of the current descriptor is a head descriptor, determining a to-be-written storage unit in a head descriptor cache module according to the queue identification, and caching the descriptor information of the current descriptor to the to-be-written storage unit; the head descriptor cache module comprises a plurality of storage units corresponding to a plurality of queue identifications one by one, and the head descriptor is a descriptor first used by a data packet; when the type of the current descriptor is a tail descriptor, determining a to-be-read storage unit in the head descriptor cache module according to the queue identification, if valid descriptor information exists in the to-be-read storage unit, outputting the descriptor information of the current descriptor to a descriptor update module first, generating an interrupt information, and then outputting the descriptor information stored in the to-be-read storage unit and the interrupt information to the descriptor update module; the tail descriptor is a descriptor last used by a data packet, and when a data packet uses only one descriptor, the type of the one descriptor is a tail descriptor; when the type of the current descriptor is an intermediate descriptor, outputting the descriptor information of the current descriptor to the descriptor update module; the intermediate descriptor is a descriptor used by a data packet except the head descriptor and the tail descriptor.

2. The method of claim 1, wherein, The method further comprises: when the descriptor type is a tail descriptor, if valid descriptor information does not exist in the to-be-read storage unit, generating an interrupt information, and outputting the descriptor information of the current descriptor and the interrupt information to the descriptor update module.

3. The method of claim 1, wherein, The descriptor information comprises a length of a message received by a buffer unit pointed by a descriptor and an identification of the buffer unit.

4. The method of claim 1, wherein, The method comprises: when writing the descriptor information of the current descriptor to the to-be-written storage unit, a head descriptor valid flag bit in the to-be-written storage unit is also written as 1; the head descriptor valid flag bit being 1 indicates that valid head descriptor information exists in the to-be-written storage unit; after outputting the descriptor information stored in the to-be-read storage unit and the interrupt information to the descriptor update unit, the head descriptor valid flag bit in the to-be-read storage unit is also written as 0; the head descriptor valid flag bit being 0 indicates that valid head descriptor information does not exist in the to-be-read storage unit.

5. A descriptor reordering module characterized by, The method comprises: a descriptor information obtaining unit, configured to obtain descriptor information, queue identification and type of a current descriptor; a first sorting unit, configured to, when the type of the current descriptor is a head descriptor, determine a to-be-written storage unit in a head descriptor cache module according to the queue identification, and cache the descriptor information of the current descriptor to the to-be-written storage unit; the head descriptor cache module comprises a plurality of storage units corresponding to a plurality of queue identifications one by one, and the head descriptor is a descriptor first used by a data packet; a second sorting unit, configured to determine a storage unit to be read in a head descriptor cache module according to the queue identifier when the type of the current descriptor is a tail descriptor, and output descriptor information of the current descriptor to a descriptor updating module and generate an interrupt information if valid descriptor information exists in the storage unit to be read, and then output the descriptor information stored in the storage unit to be read and the interrupt information to the descriptor updating module; the tail descriptor is a descriptor used by a last data packet, and when a data packet uses only one descriptor, the one descriptor is a tail descriptor; a third sorting unit, configured to output the descriptor information of the current descriptor to the descriptor updating module when the type of the current descriptor is a middle descriptor, and the middle descriptor is a descriptor used by a data packet except the head descriptor and the tail descriptor.

6. The descriptor reordering module of claim 5, wherein, The second sorting unit is further configured to generate an interrupt information and output the descriptor information of the current descriptor and the interrupt information to the descriptor updating module if valid descriptor information does not exist in the storage unit to be read when the type of the descriptor is a tail descriptor.

7. The descriptor reordering module of claim 5, wherein, The descriptor information includes a length of a packet received by a cache unit pointed by the descriptor and an identifier of the cache unit pointed by the descriptor.

8. The descriptor reordering module of claim 5, wherein, The first sorting unit is configured to write a head descriptor valid flag bit in the storage unit to be written as 1 when writing the descriptor information of the current descriptor into the storage unit to be written, and the head descriptor valid flag bit being 1 indicates that valid head descriptor information exists in the storage unit to be written. The second sorting unit is configured to write the head descriptor valid flag bit in the storage unit to be read as 0 after outputting the descriptor information stored in the storage unit to be read and the interrupt information to the descriptor updating unit. The head descriptor valid flag bit being 0 indicates that valid head descriptor information does not exist in the storage unit to be read.

9. A data processing unit, characterized by The data processing unit comprises: a packet receiving module, configured to receive a packet; a descriptor reading module, configured to read a current descriptor from a descriptor ring table of a Packed queue; a packet uploading module, configured to write the packet into a cache unit pointed by the current descriptor; the descriptor reordering module according to any one of claims 5-8; a descriptor updating module, configured to update the descriptor ring table according to the descriptor information output by the descriptor reordering module, and send an interrupt notification to a Virtio driver according to the interrupt information output by the descriptor reordering module.

10. A Virtio system, characterized by, The Virtio driver runs on a host side, and the Virtio driver is at least configured to generate the current descriptor.

Citation Information

Patent Citations

  • Packet descriptor storage in packet memory with cache

    CN109565455A

  • Technologies for reordering network packets on egress

    CN110661725A

  • Data transmission method and system of PCIe bus and electronic equipment

    CN113297112A

  • Descriptor chain table processing method, device and system, equipment and medium

    CN113721999A

  • Each of a plurality of descriptors having a completion indicator and being stored in a cache memory of an input / output processor

    US6675238B1