Packet sending optimization method, device and equipment based on camping credit dynamic flow control and storage medium
By managing the credit allocation and cache resources of the contracting engine based on dynamic flow control of pre-occupy credit, the efficiency problem of the contracting engine when acquiring main storage data is solved, and efficient resource utilization and performance improvement are achieved.
Patent Information
- Application Number
- CN202410961314.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-17
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2044-07-17
AI Technical Summary
When the packetizing engine obtains main memory data, if the data cannot be sent in time and the cache space is insufficient, it will lead to PCIE usage efficiency and blockage of other modules. The existing buffers are expensive for resource and inaccurate evaluation, making it difficult to reduce resources at the same time. Overhead and guaranteed package performance.
Using a dynamic flow control method based on pre-occupy credit, the credit requirements of DMA storage requests are applied for and allocated through the credit management module, and the credit requirements of DMA storage requests are judged based on physical page information and software configuration information, and the amount of requested data is refined to ensure the rational use of cache resources. , and compensate for credit after processing is completed.
It saves the proportion of DMA cache resources, improves the efficiency of the contracting engine to utilize PCIE, reduces resource overhead, and improves the contracting performance, especially in abnormal scenarios, which can quickly replenish credit and optimizes processing performance.
Smart Images

Figure CN118900251A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network transmission, and in particular to a packet sending optimization method, device and storage medium based on pre-occupied credit dynamic flow control. Background Art
[0002] The main function of the packet sending engine is to receive commands related to data packet sending, and convert them into data packet header commands and data read commands, then use the data read command to obtain the main memory data through the memory access module, and finally splice the data packet header with the main memory data before sending it out. The internal structure of the packet sending engine includes the command parsing module related to data packet sending, the data packet generation module, the main memory data cache module, and the data packet header and main memory data splicing and sending module, such as Figure 1 The capacity calculation of the main memory data cache module is mostly related to the latency of the memory access module and the currently expected bandwidth and line speed.
[0003] The memory access module needs to obtain the main memory data through PCIE memory access. If the read data cannot be sent out in time, and the internal data cache space of the packet sending engine is insufficient, resulting in back pressure on PCIE, it will seriously affect the efficiency of PCIE and block other modules from using PCIE.
[0004] In addition, if a buffer is implemented inside the packet engine to hold all the read-back memory access data to cache the data returned by the PCIE side, it will obviously cost a lot of resources, and the delay of PCIE is not a constant value, which makes the buffer evaluation inaccurate. Therefore, only by reducing resource overhead while ensuring that the packet performance is not affected can the efficiency of the packet engine's use of PCIE be improved. Summary of the invention
[0005] The purpose of this application is to provide a method and device for optimizing packet sending based on dynamic flow control of pre-occupied credit, aiming to reduce the overhead of accessing memory resources.
[0006] According to a first aspect of the present application, a method for optimizing packet issuance based on dynamic flow control based on pre-occupied credit is provided, comprising:
[0007] When the packet issuing engine receives a packet issuing request, if the packet issuing request is a DMA memory access request, then the packet issuing credit is applied to the credit management module according to the physical page information carried by the packet issuing request; if the packet issuing request is not a DMA memory access request, then the packet issuing credit is applied to the credit management module according to the software configuration information;
[0008] When the credit management module determines that the credit for the DMA memory access request is not greater than the currently available credit, the credit for the DMA memory access request is allocated to the downstream module, the credit for the DMA memory access request is sent to the downstream module, and the currently available credit is updated;
[0009] When the downstream module completes processing the packet issuance request, the corresponding packet issuance credit is compensated to the currently available credit of the credit management module.
[0010] In an optional implementation, applying for a package credit from a credit management module according to the software configuration information further includes:
[0011] If the packet issuance request is not a DMA memory access request, the packet issuance credit is applied to the credit management module according to the software configuration information, and the credit of the ongoing DMA memory access request is waited for to be passed. After all DMA commands are issued, the credit is issued for the current non-memory access request.
[0012] In an optional implementation, applying for a credit for a package issuance from a credit management module according to the physical page information carried in the package issuance request further includes:
[0013] The number of data packets carried by the physical page of the current memory access request is calculated according to the data length of the DMA memory access request, and then the number of data packets is multiplied by the credit consumption configured by the software to obtain the packet issuance credit of the current DMA memory access request, and the packet issuance credit is applied for from the credit management module.
[0014] In an optional implementation manner, the updating of the currently available credit further comprises:
[0015] The requested outsourcing credit is deducted from the current available credit.
[0016] In an optional implementation, the compensating the corresponding package issuance credit to the current available credit of the credit management module further includes:
[0017] For a DMA memory access request that has been processed, determine whether the current DMA data is abnormal;
[0018] If the current DMA data is normal, credit compensation is performed according to the upstream allocated credit for sending the packet, and the remaining credit of the DMA memory access request is maintained;
[0019] If the current DMA data is abnormal, credit compensation is performed according to the remaining credits of the DMA memory access request.
[0020] According to a second aspect of the present application, a packet dispatch optimization device based on pre-occupied credit dynamic flow control is provided, comprising:
[0021] a credit application unit, configured to apply for a credit for a packet issuance from a credit management module according to physical page information carried in the packet issuance request when the packet issuance engine receives a packet issuance request, if the packet issuance request is a DMA memory access request, and to apply for a credit for a packet issuance from a credit management module according to software configuration information if the packet issuance request is not a DMA memory access request;
[0022] A package issuing unit, configured to allocate the package issuing credit to a downstream module and issue the package issuing request to the downstream module, and update the currently available credit when the credit management module determines that the package issuing credit applied for the DMA memory access request is not greater than the currently available credit;
[0023] The credit compensation unit is used to compensate the corresponding package issuance credit to the currently available credit of the credit management module when the downstream module completes processing the package issuance request.
[0024] A third aspect of the present application provides an electronic device, including a processor and a memory, wherein the memory stores a plurality of instructions, and the processor is used to read the instructions and execute the method of the first aspect.
[0025] A fourth aspect of the present application provides a computer-readable storage medium, which stores a plurality of instructions, and the plurality of instructions can be read by a processor to execute the method of the first aspect.
[0026] Compared with the related art, the technical solution of this application has the following advantages:
[0027] This application saves the proportion of DMA cache resources, improves the utilization efficiency of PCIE by the packet sending engine, refines the requested data volume according to the packet granularity, and improves the packet sending performance while reducing resource overhead.
[0028] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained through the structures and processes indicated in the description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. It is obvious that the drawings described below are certain embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0030] Figure 1 It is a schematic diagram of the structure of a packet sending engine according to the relevant technology.
[0031] Figure 2 It is a flowchart of a method for optimizing packet issuance based on dynamic flow control of pre-occupied credit according to an exemplary embodiment of the present application.
[0032] Figure 3 It is a logical diagram of a packet sending engine using pre-empted credit according to an exemplary embodiment of the present application.
[0033] Figure 4 It is a logic diagram of credit management according to an exemplary embodiment of the present application.
[0034] Figure 5 4 is a logic diagram of a credit application for a non-memory access request according to an exemplary embodiment of the present application.
[0035] Figure 6 Detailed description of the invention is provided in detail.
[0036] Figure 7 is a logic diagram of credit compensation according to an exemplary embodiment of the present application. DETAILED DESCRIPTION
[0037] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0038] The method provided in the present application can be implemented in the following terminal environment, and the terminal may include one or more of the following components: a processor, a memory, and a display screen. The memory stores at least one instruction, and the instruction is loaded and executed by the processor to implement the method described in the following embodiments.
[0039] The processor may include one or more processing cores. The processor uses various interfaces and lines to connect various parts of the entire terminal, and executes various functions of the terminal and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory, and calling data stored in the memory.
[0040] The memory may include random access memory (RAM) or read-only memory (ROM). The memory may be used to store instructions, programs, codes, code sets or instructions.
[0041] The display screen is used to display the user interface of each application.
[0042] In addition, those skilled in the art can understand that the structure of the above terminal does not constitute a limitation on the terminal, and the terminal may include more or fewer components, or combine certain components, or arrange the components differently. For example, the terminal also includes components such as a radio frequency circuit, an input unit, a sensor, an audio circuit, and a power supply, which will not be described in detail here.
[0043] Based on the above analysis, the present application proposes a packet sending optimization method and device based on dynamic flow control based on pre-occupied credit, which adopts the credit pre-occupation method to determine whether the current request can be sent, so as to ensure that the internal cache DMA buffer does not overflow and the packet sending performance is guaranteed. The credit can be the clock cycle that will be consumed when the packet sending outlet processes the request, and does not include the time to read the load. For requests that carry loads, credit is applied for at the granularity of the physical page (page) carried by the request. For requests that do not carry loads, it is necessary to wait until all the read DMA commands carrying the load requests are issued before applying for credit. After each request is processed by the downstream module or each data packet is sent, the credit is compensated to the credit management module.
[0044] See also Figure 2 The flowchart of the present application shows that the method for optimizing the packet issuance based on dynamic flow control based on pre-occupied credit includes:
[0045] Step 201: When the packet sending engine receives a packet sending request, if the packet sending request is a DMA memory access request, then apply for packet sending credit from the credit management module according to the physical page information carried by the packet sending request; if the packet sending request is not a DMA memory access request, then apply for packet sending credit from the credit management module according to the software configuration information.
[0046] This application uses a pre-credited package engine, such as Figure 3 As shown, a credit management module is added on the basis of a common packet sending engine. When the request parsing module receives a packet sending request, it applies to the credit management module for credit for sending a data packet.
[0047] For example, the credit application logic for non-memory access (DMA) requests is as follows: Figure 5 As shown, after waiting for the credit of the previous memory access request to pass, the credit application is made according to the request credit configured by the software. After the credit application is passed, that is, after all DMA commands are issued, the credit of the non-memory access request is allocated. The credit of the non-memory access request is the request credit pre-configured by the software. For example, the credit application logic of the memory access (DMA) request is as follows: Figure 6 As shown, the number of data packets pkt carried by the current memory access request physical page is calculated based on the path maximum transmission unit (PMTU) and the memory access request data length. _num(pkt_num=memory access request data length / PMTU). If the data length carried by the physical page is not an integer multiple of PMTU, pkt_num is increased by 1, and then pkt_num is multiplied by the credit consumption configured by the software to obtain the credit value of the current memory access request, and the credit is applied to the credit module. After obtaining the credit, the memory access command can be issued. Optionally, when an exception occurs in the physical page, credit is applied according to the number of remaining packets requested to ensure that credit is not leaked.
[0048] Step 202: When the credit management module determines that the packet issuance credit applied for the DMA memory access request is not greater than the currently available credit, the packet issuance credit is allocated to the downstream module, and the packet issuance request is sent to the downstream module, and the currently available credit is updated.
[0049] In a preferred embodiment, the available credit is calculated in the initial state as follows:
[0050] total _ credit = host-side data bandwidth reading delay × line speed × shortest packet header processing cycle.
[0051] The logic of the credit management module is as follows Figure 4 As shown, first determine whether there is currently available credit. If there is no available credit, reject the credit application and only wait for downstream compensation credit. When there is available credit, if the currently applied credit is less than or equal to the current credit, the current credit application is approved, and the applied credit for issuing the package is deducted from the currently available credit. After the credit application is approved, the generated control information and physical page are distributed to the downstream module. According to a preferred embodiment, the data packet splicing module is used to splice and issue the data packet.
[0052] Step 203: When the downstream module completes processing the packet issuance request, the corresponding packet issuance credit is compensated to the currently available credit of the credit management module.
[0053] Credit compensation logic is as follows Figure 7 As shown, after each request is processed, the credit of the request is compensated to the credit management module. Specifically, it is determined whether the request currently processed is a memory access request. If it is a memory access request, it is determined whether the current DMA data is abnormal. If normal, credit compensation is performed according to the upstream allocated credit, and the remaining credit of the request is maintained. If abnormal, credit compensation is performed according to the remaining credit of the request. If it is not a memory access request, compensation is performed directly according to the credit allocated by the upstream.
[0054] It can be seen that the packet sending optimization method based on pre-occupied credit dynamic flow control proposed in this application has the following advantages compared with the relevant technology: it saves the proportion of DMA cache resources, improves the utilization efficiency of PCIE by the packet sending engine, refines the request data volume according to the packet granularity, and improves the packet sending performance while reducing resource overhead. The solution of this application adopts the software to dynamically configure the total credit and independently allocate credits by request type. It is more friendly to software. This solution can quickly replenish credits in abnormal scenarios and optimize the processing performance of the packet sending engine. This solution counts the time period consumed by each request at the packet sending exit, and then feeds back the credit recommendation value of each request to the software, which improves the rationality of credit configuration. Take the PCIE delay of 2000ns, PCIE bandwidth of 400Gbps, line speed of 100Mpps, minimum packet length of 64B, and the non-data processing period of 4T for each packet sent by the data packet export module as an example. Experiments show that in the traditional method, the amount of data that needs to be cached every 2000ns is: 2000ns×100Mpps×4T×64B≈800×64B. Due to the cumulative effect, the amount of data will continue to accumulate, and no matter how large the buffer is, the back pressure of PCIE cannot be avoided. After applying the solution of this application, the amount of DMA data read is controlled to be 2000ns×100Mpps×64B+64×64 (guaranteeing 100Mpps) every 2000ns, and the cache data depth can be set to 64. The proportion of DMA cache resources saved can be as high as 90%.
[0055] Accordingly, in a second aspect, the present application provides a packet dispatch optimization device based on pre-occupied credit dynamic flow control, comprising:
[0056] a credit application unit, configured to apply for a credit for a packet issuance from a credit management module according to physical page information carried in the packet issuance request when the packet issuance engine receives a packet issuance request, if the packet issuance request is a DMA memory access request, and to apply for a credit for a packet issuance from a credit management module according to software configuration information if the packet issuance request is not a DMA memory access request;
[0057] A package issuing unit, configured to allocate the package issuing credit to a downstream module and issue the package issuing request to the downstream module, and update the currently available credit when the credit management module determines that the package issuing credit applied for the DMA memory access request is not greater than the currently available credit;
[0058] The credit compensation unit is used to compensate the corresponding package issuance credit to the currently available credit of the credit management module when the downstream module completes processing the package issuance request.
[0059] The above-mentioned device can be implemented through the packet sending optimization method based on pre-occupied credit dynamic flow control provided by the embodiment of the first aspect above. The specific implementation method can be found in the description of the embodiment of the first aspect, which will not be repeated here.
[0060] It is understood that the module structures, names and parameters described in the above embodiments are only examples. Those skilled in the art can also easily combine and adjust the structural features of the above embodiments according to the use requirements, and should not limit the concept of the present application to the specific details of the above examples.
[0061] The present application also provides an electronic device, including a processor and a memory, wherein the memory stores a plurality of instructions, and the processor is used to read the instructions and execute any one of the methods in the aforementioned first aspect. The processor and the memory may be connected via a bus or in other ways, taking the bus connection as an example. The processor may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components and other chips, or a combination of the above-mentioned various types of chips.
[0062] As a non-transitory computer-readable storage medium, the memory can be used to store non-transitory software programs, non-transitory computer executable programs and modules, such as program instructions / modules corresponding to the method in the embodiment of the present application. The processor executes various functional applications and data processing of the processor by running the non-transitory software programs, instructions and modules stored in the memory, that is, implementing the method in the above method embodiment.
[0063] The memory may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created by the processor, etc. In addition, the memory may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0064] The present application also provides an electronic device, comprising a processor and a memory connected to the processor, wherein the memory stores a plurality of instructions, and the instructions can be loaded and executed by the processor, so that the processor can perform any one of the methods in the first aspect described above. The computer-readable storage medium can be a tangible storage medium, such as a random access memory (RAM), a memory, a read-only memory (ROM), an electrically programmable ROM, an electrically erasable programmable ROM, a register, a floppy disk, a hard disk, a removable storage disk, a CD-ROM, or any other form of storage medium known in the technical field.
[0065] Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that he or she may still modify the technical solutions described in the aforementioned embodiments, or make equivalent substitutions for some of the technical features therein; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for optimizing packet dispatching based on dynamic flow control of pre-occupied credit, characterized in that: include: When the packet issuing engine receives a packet issuing request, if the packet issuing request is a DMA memory access request, then the packet issuing credit is applied to the credit management module according to the physical page information carried by the packet issuing request; if the packet issuing request is not a DMA memory access request, then the packet issuing credit is applied to the credit management module according to the software configuration information; When the credit management module determines that the credit for the DMA memory access request is not greater than the currently available credit, the credit for the DMA memory access request is allocated to the downstream module, the credit for the DMA memory access request is sent to the downstream module, and the currently available credit is updated; When the downstream module completes processing the packet issuance request, the corresponding packet issuance credit is compensated to the currently available credit of the credit management module.
2. The method for optimizing packet dispatching based on dynamic flow control of pre-occupied credit according to claim 1, characterized in that: The step of applying for a package credit from the credit management module according to the software configuration information further includes: If the packet issuance request is not a DMA memory access request, the packet issuance credit is applied to the credit management module according to the software configuration information, and the credit of the ongoing DMA memory access request is waited for to be passed. After all DMA commands are issued, the credit is issued for the current non-memory access request.
3. The method for optimizing packet dispatching based on dynamic flow control of pre-occupied credit according to claim 1, characterized in that: Applying for a credit for a package issuance from a credit management module according to the physical page information carried in the package issuance request further includes: The number of data packets carried by the physical page of the current memory access request is calculated according to the data length of the DMA memory access request, and then the number of data packets is multiplied by the credit consumption configured by the software to obtain the packet issuance credit of the current DMA memory access request, and the packet issuance credit is applied for from the credit management module.
4. The method for optimizing packet dispatching based on dynamic flow control of pre-occupied credit according to claim 1, characterized in that: The updating of the currently available credit further comprises: The requested outsourcing credit is deducted from the current available credit.
5. The method for optimizing packet dispatching based on dynamic flow control of pre-occupied credit according to claim 1, characterized in that: The compensating the corresponding package issuance credit to the current available credit of the credit management module further includes: For a DMA memory access request that has been processed, determine whether the current DMA data is abnormal; If the current DMA data is normal, credit compensation is performed according to the upstream allocated credit for sending the packet, and the remaining credit of the DMA memory access request is maintained; If the current DMA data is abnormal, credit compensation is performed according to the remaining credits of the DMA memory access request.
6. A packet dispatching optimization device based on pre-occupied credit dynamic flow control, characterized in that: include: a credit application unit, configured to apply for a credit for a packet issuance from a credit management module according to physical page information carried in the packet issuance request when the packet issuance engine receives a packet issuance request, if the packet issuance request is a DMA memory access request, and to apply for a credit for a packet issuance from a credit management module according to software configuration information if the packet issuance request is not a DMA memory access request; A package issuing unit, configured to allocate the package issuing credit to a downstream module and issue the package issuing request to the downstream module, and update the currently available credit when the credit management module determines that the package issuing credit applied for the DMA memory access request is not greater than the currently available credit; The credit compensation unit is used to compensate the corresponding package issuance credit to the currently available credit of the credit management module when the downstream module completes processing the package issuance request.
7. The packet dispatching optimization device based on pre-occupied credit dynamic flow control according to claim 6 is characterized in that: The credit application unit is further used to: If the packet issuance request is not a DMA memory access request, the packet issuance credit is applied to the credit management module according to the software configuration information, and the credit of the ongoing DMA memory access request is waited for to be passed. After all DMA commands are issued, the credit is issued for the current non-memory access request.
8. The packet dispatching optimization device based on pre-occupied credit dynamic flow control according to claim 6 is characterized in that: The credit application unit is further used to: The number of data packets carried by the physical page of the current memory access request is calculated according to the data length of the DMA memory access request, and then the number of data packets is multiplied by the credit consumption configured by the software to obtain the packet issuance credit of the current DMA memory access request, and the packet issuance credit is applied for from the credit management module.
9. The packet dispatching optimization device based on pre-occupied credit dynamic flow control according to claim 6, characterized in that: The contract issuing unit is further used for: The requested outsourcing credit is deducted from the current available credit.
10. The packet dispatching optimization device based on pre-occupied credit dynamic flow control according to claim 6, characterized in that: The credit compensation unit is further used to: For a DMA memory access request that has been processed, determine whether the current DMA data is abnormal; If the current DMA data is normal, credit compensation is performed according to the upstream allocated credit for sending the packet, and the remaining credit of the DMA memory access request is maintained; If the current DMA data is abnormal, credit compensation is performed according to the remaining credits of the DMA memory access request.
11. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory stores a plurality of instructions, and the processor is used to read the instructions and execute the packet sending optimization method based on pre-occupied credit dynamic flow control as described in any one of claims 1 to 5.
12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a plurality of instructions, and the plurality of instructions can be read by a processor and executed by the packet sending optimization method based on dynamic flow control based on pre-occupied credit as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Credit scheme for multi-queue memory controllers
US11379388B1
Credit based memory scheduler
US11768630B1
Transporting operations of arbitrary size over remote direct memory access
US20130007180A1
Fine-grained bandwidth provisioning in a memory controller
US20150293709A1
RDMA data flow control method and system, electronic device and readable storage medium
WO2021057068A1
