A descriptor reordering method and module, data processing unit

By reordering the descriptors in the Virtio system, the "partial packet problem" when receiving messages in MERGEABLE mode is solved, ensuring that all descriptors are updated before the data processing unit reads the descriptor chain, thus avoiding data transmission errors.

CN120909708BActive Publication Date: 2025-12-23SHENZHEN JAGUAR MICROSYSTEMS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

The "partial packet problem" occurs when the Virtio system receives messages in MERGEABLE mode. This means that the Virtio driver fails to read the data packet completely when reading the descriptor chain, resulting in data transmission errors.

Method used

By reordering descriptors into first descriptors, middle descriptors, or last descriptors, and managing and sorting them by type and output order, the Virtio driver ensures that when reading the descriptor chain, it only reads the descriptor only after all descriptors in the entire descriptor chain have been updated by the data processing unit.

Benefits of technology

This avoids the "partial packet" phenomenon, ensuring that the Virtio driver reads the data packet completely, thus improving the accuracy and reliability of data transmission.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120909708B_ABST
    Figure CN120909708B_ABST
Patent Text Reader

Abstract

The application relates to a descriptor reordering method and module and a data processing unit, which comprises the following steps: obtaining descriptor information of a current descriptor; if the current descriptor is a first descriptor, buffering the descriptor information of the current descriptor in a first descriptor buffer module on the data processing unit side; if the current descriptor is an intermediate descriptor, outputting the descriptor information of the current descriptor to a descriptor updating module; if the current descriptor is a last descriptor and the first descriptor of the corresponding queue has been buffered, first outputting the descriptor information of the current descriptor to the descriptor updating module, generating an interrupt information, and then outputting the descriptor information of the first descriptor of the corresponding queue of the current descriptor to the descriptor updating module, so that the “half packet problem” occurring when a Virtio system receives a packet in a 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 the Virtio driver and the 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 (Descriptor, also known as a buffer descriptor, Buffer Descriptor, abbreviated as BD) in the descriptor ring table (Descriptor Ring) of the Packed queue includes the following fields: a buffer unit address (Buffer Address), a buffer unit length (Buffer Length), a buffer unit ID (Buffer ID) and a flag (Flag); the buffer unit address points to a block of free buffer units (buffer) for storing the message sent by the Virtio network device; the buffer unit ID is used to identify or locate the buffer unit associated with the message, and the buffer unit corresponding to the message is found in the host memory by means of the buffer unit ID; 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:

[0005] The Virtio driver allocates a Buffer for receiving a message, fills information such as an address, a length and an ID of the Buffer into a descriptor, and sets a VRING_DESC_F_AVAIL flag and a VRING_DESC_F_USED flag of the descriptor to indicate that the descriptor is available and to inform the Virtio network device;

[0006] The Virtio network device detects that a message arrives, starts to enter a message receiving process, reads the available descriptor, writes the message into the Buffer pointed to by the descriptor, and if the Virtio network device and the Virtio driver successfully negotiate the MERGAEGBLE feature, can apply for multiple descriptors when the Buffer pointed to by one descriptor cannot store one data packet. After the write operation is completed, the Virtio network device writes the length of the message 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 message has been received and stored in the Buffer pointed to by the descriptor;

[0007] After receiving the interrupt signal, the Virtio driver acquires the length of the message, the Buffer ID and a flag (Flag) of the used descriptor, reads the message from the corresponding Buffer according to the descriptor, and performs corresponding processing, such as analyzing the network message and updating the application state.

[0008] For the Packed queue, in the MERGEABLE mode, as Figure 2As shown, assuming that receiving a data packet requires using 3 descriptors, the Virtio network device uses the 3 descriptors in the order of descriptor 0→descriptor 1→descriptor 2, and after writing a message in a packet into a Buffer pointed to by any descriptor each time, the Virtio network device needs to update the Buffer, that is, the Virtio network device writes the length of the message 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 the descriptor 0 and sends an interrupt signal to the Virtio driver, when the Virtio driver reads the descriptor 0 in response to the interrupt signal, the Virtio driver will try to read all the descriptors in the descriptor chain corresponding to the descriptor 0 to improve processing efficiency, that is, the descriptors 0~2 are read together, but at this time, the descriptors 1~2 have not been updated, so the Virtio driver will only read the message in the Buffer corresponding to the descriptor 0, and the messages in the Buffers corresponding to the 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

[0009] 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.

[0010] To achieve the above-mentioned purpose, according to the first aspect of the present application, a descriptor reordering method is provided, which comprises:

[0011] obtaining descriptor information, a queue identifier and a type of a current descriptor;

[0012] when the type of the current descriptor is a first descriptor, determining a to-be-written storage unit in a first 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 first descriptor cache module comprises a plurality of storage units corresponding to a plurality of queue identifiers one by one, and the first descriptor is the first descriptor used for a data packet;

[0013] When the type of the current descriptor is a tail descriptor, a to-be-read storage unit in the head descriptor cache module is determined according to the queue identifier, and if valid descriptor information exists in the to-be-read storage unit, descriptor information of the current descriptor is first output to a descriptor update module, an interrupt information is generated, and then the descriptor information stored in the to-be-read storage unit and the interrupt information are output to the descriptor update module; the tail descriptor is a descriptor used last by a data packet, and when a data packet uses only one descriptor, the one descriptor is a tail descriptor;

[0014] When the type of the current descriptor is a middle descriptor, the descriptor information of the current descriptor is output to the descriptor update module; the middle descriptor is a descriptor used by a data packet except the head descriptor and the tail descriptor.

[0015] In some embodiments, the method further comprises:

[0016] When the type of the descriptor is a tail descriptor, if valid descriptor information does not exist 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 the descriptor update module.

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

[0018] In some embodiments, the method comprises:

[0019] 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 valid head descriptor information exists in the to-be-written storage unit.

[0020] After the descriptor information stored in the to-be-read storage unit and the interrupt information are output to the descriptor update unit, 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 valid head descriptor information does not exist in the to-be-read storage unit.

[0021] According to a second aspect of the present application, a descriptor reordering module is provided, comprising:

[0022] a descriptor information acquisition unit, configured to acquire descriptor information of a current descriptor, a queue identifier and a type;

[0023] The first sorting unit is 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 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;

[0024] The second sorting unit is 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 valid descriptor information exists in the to-be-read storage unit, 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.

[0025] The third sorting unit is configured to, when the type of the current descriptor is an intermediate descriptor, output the descriptor information of the current descriptor to the descriptor updating module; the intermediate descriptor is a descriptor used by a data packet except the head descriptor and the tail descriptor.

[0026] 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 to-be-read storage unit, generate an interrupt information, and output the descriptor information of the current descriptor and the interrupt information to the descriptor updating module.

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

[0028] 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 as 1; the head descriptor valid flag bit being 1 indicates that valid head descriptor information exists in the to-be-written storage unit.

[0029] 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 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.

[0030] According to a third aspect of the present application, a data processing unit is provided, characterized in that comprising:

[0031] a packet receiving module, configured to receive a packet;

[0032] a descriptor reading module, configured to read a current descriptor from a descriptor ring table of a Packed queue;

[0033] a packet uploading module, configured to write the packet into a cache unit pointed by the current descriptor;

[0034] a descriptor reordering module as described in the first aspect of the present application;

[0035] 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.

[0036] According to a fourth aspect of the present application, a Virtio system is provided, characterized in that comprising a Virtio driver and the data processing unit as described in the first aspect of the present application, the Virtio driver running on a host side, and the Virtio driver being at least configured to generate the current descriptor.

[0037] The above-mentioned descriptor reordering method and module, data processing unit and Virtio system provided by the present application have the following beneficial effects:

[0038] The present application proposes to reorder and update the descriptors in view of the "half packet problem" when the Virtio system receives a packet in the MERGEABLE mode, each descriptor used by a data packet is classified as a head descriptor, a middle descriptor or a tail descriptor according to the use order; the data processing unit (DPU) manages the descriptors and orders the output sequence according to the descriptor type, so as to ensure that the Virtio driver reads the descriptor chain only when all the descriptors of the entire descriptor chain are updated by the data processing unit (DPU), and then reads the descriptor chain at one time, thereby avoiding the "half packet" phenomenon. BRIEF DESCRIPTION OF DRAWINGS

[0039] 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.

[0040] Figure 1 The packet uploading flowchart disclosed in the background art.

[0041] Figure 2 A schematic diagram of sequentially updating descriptors in the background art.

[0042] Figure 3 A flowchart of a descriptor reordering method in an embodiment of the present application.

[0043] Figure 4 A flowchart of a DPU receiving a packet in an embodiment of the present application.

[0044] Figure 5 A schematic diagram of intermediate descriptor reordering in an embodiment of the present application.

[0045] Figure 6 An example of descriptor information of different queues interleaving inputting the FIFO module.

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

[0047] 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 practiced. It is to be understood that the same or equivalent functions can be accomplished by different embodiments that are intended to be encompassed within the spirit and scope of the present application.

[0048] Referring to Figure 3 , one embodiment of the present application provides a descriptor reordering method applied to a data processing unit (DPU), the method comprising:

[0049] Step S10, obtaining descriptor information, a queue identifier and a type of a current descriptor;

[0050] Specifically, as Figure 4 shown is a flowchart of a DPU receiving a packet in the method of the present embodiment, referring to Figure 4 , after receiving a data packet, the DPU temporarily saves the data packet in a DPU internal cache, reads a descriptor (Descriptor Ring) from a descriptor ring table of a Packed queue for reporting the received data packet, 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, slices the data packet according to the length of the applied Buffer, uploads the sliced packet to the Buffer pointed to by the descriptor, continues to apply a new descriptor for the remaining packet, finally writes the packet slices into each Buffer pointed to by the descriptor, and finally updates descriptor information of the used descriptor to indicate that the descriptor is used;

[0051] The descriptor reordering method is proposed for the descriptor updating task to avoid the "half packet problem" of the Virtio driver when reading the descriptors / packets after the descriptor is updated, as shown in Figure 5 The schematic diagram of the embodiment method is shown in Figure 5 The "descriptor information, queue id (qid) and type" of all used descriptors are sent to a FIFO module, the FIFO module follows the first-in first-out principle, the descriptor information entering the FIFO module first is output first, the FIFO module can play a role of caching and processing the descriptor information in sequence, and the step S10 of the embodiment method acquires the descriptor information of the current descriptor output by the FIFO module; the descriptor type includes a first descriptor, an intermediate descriptor or a last descriptor; the first descriptor refers to the first descriptor used to store a data packet, the Buffer pointed to by the first descriptor stores the start part of the packet; the last descriptor refers to the last descriptor used to store a data packet, the Buffer pointed to by the last descriptor stores the end part of the packet, and the intermediate descriptor is a descriptor used to store a data packet except the first descriptor and the last descriptor, the Buffer pointed to by the intermediate descriptor stores the middle part of the packet, and the first descriptor, the intermediate descriptor and the last descriptor corresponding to a data packet enter the FIFO module in sequence.

[0052] In step S20, when the type of the current descriptor is the first descriptor, the to-be-written storage unit in the first 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 first descriptor cache module includes a plurality of storage units corresponding to a plurality of queue ids one by one, and the first descriptor is the first descriptor used for a data packet;

[0053] Specifically, the first descriptor cache module is a RAM (Random Access Memory) structure, and taking the queue Q1 as an example, when the descriptor information of the first descriptor BD0 of the queue Q1 is acquired, the descriptor information of the first descriptor BD0 is not output immediately, but is temporarily cached in the first descriptor cache module of the DPU, and then the descriptor information of the first descriptor BD0 is output after the descriptor information of other descriptors of the queue Q1 is output, so that it is ensured that the information of all descriptors of the entire descriptor chain is updated by the Virtio device when the Virtio driver reads the descriptor chain.

[0054] 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;

[0055] 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.

[0056] 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 obtained, 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.

[0057] 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.

[0058] 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.

[0059] 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.

[0060] 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.

[0061] 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.

[0062] In some embodiments, the method further includes:

[0063] 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.

[0064] 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 processing logic of the DPU, 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.

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

[0066] In some embodiments, the method comprises:

[0067] 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.

[0068] After the descriptor information stored in the to-be-read storage unit and the interrupt information are output to the descriptor update unit, 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.

[0069] Specifically, each storage unit in the head descriptor cache module uses the queue identifier (QID) of the queue corresponding to the storage unit as an index, and uses the index as the basis 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 the 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 also 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 simply rewritten as 0. The descriptor information of the head descriptor of the 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.

[0070] Corresponding to the method of the above embodiment, another embodiment of the present application provides a descriptor reordering module, comprising:

[0071] a descriptor information obtaining unit, configured to obtain descriptor information, a queue identifier and a type of a current descriptor;

[0072] 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;

[0073] 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;

[0074] a third sorting unit, configured to, when the type of the current descriptor is an intermediate descriptor, output the descriptor information of the current descriptor to the descriptor updating module; the intermediate descriptor is a descriptor used by a data packet except the head descriptor and the tail descriptor.

[0075] In some embodiments, the second sorting unit is further configured to, when the descriptor type 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.

[0076] In some embodiments, the descriptor information comprises 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.

[0077] 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 there is valid head descriptor information in the to-be-written storage unit.

[0078] The second sorting unit is configured to write a first descriptor valid flag in the to-be-read storage unit as 0 after outputting the descriptor information stored in the to-be-read storage unit and the interrupt information to the descriptor updating unit; the first descriptor valid flag being 0 indicates that there is no valid first descriptor information in the to-be-read storage unit.

[0079] It should be noted that the descriptor reordering module of the embodiment corresponds to the method of the above embodiment, and the contents not described in detail in 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.

[0080] Another embodiment of the present application further provides a data processing unit (DPU), comprising:

[0081] a packet receiving module configured to receive a packet;

[0082] a descriptor reading module configured to read a current descriptor from a descriptor ring table of a Packed queue;

[0083] a packet uploading module configured to write the packet into a cache unit pointed by the current descriptor;

[0084] a descriptor reordering module as described in the first aspect of the present application;

[0085] a descriptor updating module configured to update the descriptor ring table according to a packet length and a cache unit ID output by the descriptor reordering module, and send an interrupt notification to a Virtio driver according to interrupt information output by the descriptor reordering module.

[0086] Another embodiment of the present application further provides a data processing unit (DPU), comprising:

[0087] a communication interface configured to communicate with other electronic devices;

[0088] a memory configured to store computer program instructions;

[0089] 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.

[0090] In this 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 the operation device and at least one function, and the data storage area can store relevant 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, a flash card, or other volatile solid-state storage devices.

[0091] The processor can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor, or the processor can also be any conventional processor. The processor is the control center of the data processing unit, and connects various parts of the data processing unit through various interfaces and lines.

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

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

[0094] Specifically, the computer program product includes 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 run on various computer devices to implement the descriptor ring table updating of the above embodiments.

[0095] Having described various embodiments of the application, it is to be understood that the above description is meant not to limit and not to encompass all of the possible embodiments. Many modifications and variations of this application can be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. It is intended that the scope of the application be defined by the scope of the patent and by the claims as allowed by the patent office, which can include adaptations based on the description, equivalents, and / or substitutions of elements individually or collectively to the entire disclosure.

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 cache unit pointed by a descriptor and an identification of the cache unit pointed by the descriptor.

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, a 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