Data packet caching method, terminal and computer readable storage medium

By dividing data packets into multiple data packets and storing them in parallel, the problem of low data packet caching efficiency between high-speed network interfaces and memory is solved, enabling correct data packet recovery and ordered output, and improving data throughput.

CN123157141APending Publication Date: 2026-11-24PENG CHENG LAB
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611401969.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-09-10
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

Existing cache nodes suffer from low access efficiency and difficulty in quickly and correctly recovering and orderly outputting data packets during data transmission between high-speed network interfaces and storage. This is especially true when data arrives continuously, as the storage access method is incompatible with the interface data organization, affecting the continuous caching and output of data packets.

Method used

A packet caching method is adopted to divide the data packet into multiple data blocks, and each data block into multiple data fragments. Parallel writing and reading are performed through multiple parallel storage access paths. By utilizing the mapping relationship between the synchronous access unit number and the path address, the consistency of the association and location of the data fragments is ensured. During reading, the data packets are reassembled and output in the order of the data packets.

Benefits of technology

It improves the efficiency of data packet access in cache nodes, ensures the correct recovery and orderly output of data packets, and reduces the dependence on a single path by utilizing multi-path parallel access capabilities, thereby improving data throughput.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123157141A_ABST
    Figure CN123157141A_ABST
Patent Text Reader

Abstract

This application discloses a data packet caching method, a terminal, and a computer-readable storage medium, relating to the field of data processing technology. The method includes: receiving data packets; allocating descriptor indexes and initial cache blocks; establishing a data packet descriptor that records the identifier of the first cache block; dividing each data packet into multiple fragments; allocating a synchronous access unit for the same data packet; associating each fragment with the same unit number; and writing data in parallel along each path according to the path address mapping relationship. When the current cache block is exhausted, new blocks are allocated and linked as needed; and information for each block is recorded based on the actual writing status. After all fragments have been written and a write completion feedback is received, the descriptor index is enqueued. During reading, the unit to be read is determined based on the data packet descriptor, link, etc.; fragments are read in parallel according to the same mapping relationship; the data packets are reassembled and output in order. This method improves the parallelism of cache access, avoids reading units that have not been written, and maintains the order of data packet output.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing, and more particularly to a data packet caching method, a terminal, and a computer-readable storage medium. Background Technology

[0002] With the increasing transmission speed of data center networks, high-speed network interfaces typically employ wider data paths within nodes, providing more data to the cache processing logic within a single effective transmission cycle. In scenarios such as cross-domain Remote Direct Memory Access (RDMA) asynchronous transmission, the arrival of upstream data and the output of downstream data may be asynchronous. Cache nodes need to temporarily store the continuously input data packets from the high-speed network interface and read and forward them when output conditions are met. Therefore, the storage access capacity of the cache node needs to be adapted to the data input and output requirements of the interface. Existing cache nodes can use on-chip memory, double data rate memory, or high-bandwidth memory to store data packets, but the data path width of the high-speed network interface may differ from the single access width, access granularity, and storage organization of the memory. When the amount of data provided by the interface at one time exceeds the amount of data that a single storage access path can process at one time, if access is mainly completed sequentially through this path, multiple accesses are required to process one piece of interface data. When data arrives continuously, this access method may limit the data throughput capacity of the cache node, and simply increasing storage capacity cannot eliminate these limitations.

[0003] Storage resources with multiple access paths provide the means to improve access capabilities, but their physical access capabilities are not directly equivalent to their effective processing capabilities for high-speed network interface input data. After data is distributed across different storage locations, it is also necessary to maintain the correspondence between the stored content and the original data packets, and to restore the original data organization and packet order during retrieval. When the storage access method is incompatible with the interface data organization, it may also increase the processing burden of data location and recovery, affecting the continuous caching and output of data packets. Therefore, how to adapt to the wide data paths and continuous data input characteristics of high-speed network interfaces, and achieve correct and orderly recovery of data packets while improving caching and access efficiency, is a technical problem that needs to be solved. Summary of the Invention

[0004] The main purpose of this application is to provide a data packet caching method, a terminal, and a computer-readable storage medium, aiming to solve the problems of low caching access efficiency and difficulty in quickly and correctly recovering data packets in related technologies, so as to improve the data processing and transmission capabilities of high-speed network interfaces.

[0005] To achieve the above objectives, a first aspect of this application provides a data packet caching method. This method is applied to a cache node having multiple parallel storage access paths, including multiple data access paths for transmitting data fragments. The method includes parallel writing of data fragments and parallel reading, reassembly, and output of data fragments. The parallel writing of the data packets includes: Receive data packets, allocate descriptor indexes and initial buffer blocks for the aforementioned data packets, and use the aforementioned initial buffer blocks as the current buffer blocks; A data packet descriptor is established based on the identifier of the initial cache block. The identifier of the initial cache block is recorded as the identifier of the first cache block in the data packet descriptor. A correspondence between the descriptor index and the data packet descriptor is established. Each cache block contains multiple consecutive synchronous access units, and each synchronous access unit includes multiple storage locations that correspond one-to-one with the multiple data access paths. Each of the above data packets is divided into multiple data fragments. A synchronization access unit is allocated for each data packet from the current cache block, and each data fragment is associated with the number of the synchronization access unit. Before allocating a synchronization access unit for each data packet of the above data packet, if the synchronization access units in the current cache block have been exhausted, a new cache block is allocated, the link information from the current cache block to the new cache block is recorded, and the new cache block is used as the current cache block. Based on the above numbering and the preset path address mapping relationship, the write address of each parallel storage access path is determined, and each data fragment is written in parallel through the corresponding path. After the above data packet is written and a write completion feedback is received, the above descriptor index is added to the queue; The parallel reading, reassembly, and output of the aforementioned data fragments include: retrieving the descriptor index of the data packet to be output from the aforementioned queue, reading the corresponding data packet descriptor, determining the synchronous access unit to be read based on the first buffer block identifier and the aforementioned link information, generating a read address according to the same path address mapping relationship as when writing, reading the data fragments of the same synchronous access unit in parallel, reassembling them according to the data packet order of the aforementioned data packets, and outputting them.

[0006] Optionally, the step of writing each data shard in parallel via the corresponding path further includes: For each of the above data snapshots, obtain the corresponding metadata, which includes valid byte markers and packet end markers; The data fragments of the aforementioned data packet are used as payload fragments and written to different address areas along with the aforementioned metadata via different parallel storage access paths. The two are associated with the same synchronous access unit number allocated to the aforementioned data packet. The write completion feedback covers the writing of the payload fragments and corresponding metadata of the aforementioned data packet.

[0007] Optionally, the above path address mapping relationship is as follows: the access address of each parallel memory access path is equal to the sum of the base address of the path and the address offset, wherein the address offset is the product of the synchronous access unit number and the address interval of the adjacent synchronous access units in the path.

[0008] Optionally, the above method further includes: Based on the number of valid bytes written to the data packet, the identifier of the buffer block used, and the number of synchronization access units occupied, update the data packet length, tail buffer block identifier, and number of synchronization access units in the above data packet descriptor; Maintain a cache block descriptor for each cache block, record the range of valid synchronous access units and the aforementioned link information, so as to determine the read range of each cache block and the next cache block during the aforementioned parallel read.

[0009] Optionally, the parallel reading, reassembly, and output of the above data shards include: Based on the data packet sequence of the above data packet, read requests are sent to each synchronous access unit, and read requests are simultaneously initiated to each parallel storage access path corresponding to the same synchronous access unit. The returned data fragments are temporarily stored according to their corresponding synchronization access units. After all data fragments in the same synchronization access unit are returned, all the above data fragments are reassembled into the corresponding data fragments; and, When a later data frame is read before an earlier data frame, the later data frame is temporarily stored. After all the data frames before the later data frame have been output, the later data frame is then output.

[0010] Optionally, during the parallel reading and reassembly of the data fragments, the payload fragments and corresponding metadata are obtained from the different address regions according to the synchronization access unit number assigned to the data fragment. The data fragments are assembled according to the fragment correspondence at the time of writing, and the valid bytes and data packet boundaries are restored according to the valid byte markers and packet tail markers in the metadata.

[0011] Optionally, after the above-mentioned data packet reassembly and output are completed, cache resource reclamation is performed, which includes: Based on the first cache block identifier in the above packet descriptor, release each cache block occupied by the above packet in sequence along the above link information; After all the above cache blocks are released, the above data packet descriptors are invalidated and the corresponding descriptor indexes are reclaimed.

[0012] Optionally, the aforementioned data packet descriptor also records a responsibility status and an acknowledgment overlay flag. The responsibility status is used to indicate whether it is necessary to continue retaining the buffer resources of the aforementioned data packet, and the acknowledgment overlay flag is used to indicate the range of data in the aforementioned data packet that has been acknowledged by the downstream. After the above data packet is output, the above responsibility status is updated to confirmation waiting status, and the buffer block occupied by the above data packet and the corresponding data packet descriptor are retained; The aforementioned confirmation overlay flag is updated based on the downstream confirmation information, and the aforementioned cache resource reclamation is performed only when the aforementioned confirmation overlay flag indicates that the entire data range of the aforementioned data packet has been confirmed to be received by the downstream.

[0013] A second aspect of this application provides a terminal, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps of any of the above-described data packet caching methods.

[0014] A third aspect of this application provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of any of the above-described data packet caching methods.

[0015] As can be seen from the above, the present application provides a data packet caching method, which includes: dividing data packets into multiple data blocks, and then dividing each data block into data fragments corresponding to multiple parallel storage access paths, so that the writing and reading of the same data block can be carried out in parallel by multiple paths. Compared with the method of sequentially accessing the same data block through a single path, this reduces the dependence of the data block access on the sequential access of a single path, which is beneficial to utilizing the parallel access capability of multiple paths and improving the access efficiency of data packet caching. By assigning a synchronous access unit to each data block, multiple data fragments belonging to the same data block are associated with the same unit number, and the access address of each path is determined according to the number and path address mapping relationship, providing a common association and location basis for the distributed data fragments. During reading, the number and mapping relationship during writing are reused, which can locate each fragment of the same data block, maintain the consistency of fragment ownership and read / write position across paths, and provide a clear basis for data reorganization. Based on this, the multiple data fragments read in parallel are reassembled into corresponding data segments and output according to the order of each data segment in the data packet. This connects multi-path storage access with the orderly recovery of data packets, thereby maintaining the data content and order within the packet while utilizing parallel access capabilities, and taking into account both the access efficiency and output correctness of the data packet cache. Attached Figure Description

[0016] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0017] Figure 1 This is a flowchart illustrating a data packet caching method provided in an embodiment of this application; Figure 2 This is a schematic diagram of the cache nodes, their data flow, and management control relationships in the embodiments of this application; Figure 3 This is a schematic diagram of the three-level mapping between data packet descriptors, cache block descriptors, and synchronization access units in an embodiment of this application; Figure 4 This is a schematic diagram illustrating the specific process of storing the payload fragments and metadata of the same data capture through different paths and determining the access address based on the same synchronization access unit number in the embodiments of this application. Figure 5 This is a schematic diagram of the data packet writing, cache block continuation, and descriptor index enqueue process in the embodiments of this application; Figure 6 This is a schematic diagram of the process of parallel reading of data fragments, return alignment, and output according to the data snapshot order in the embodiments of this application; Figure 7 This is a schematic diagram of the confirmation waiting and cache resource reclamation process after the entire package is output in this embodiment of the application; Figure 8 This is a block diagram illustrating the internal structure of a terminal provided in an embodiment of this application. Detailed Implementation

[0018] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods are omitted so as not to obscure the description of this application with unnecessary detail.

[0019] It should be understood that, when used in this specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.

[0020] It should also be understood that the terminology used in this application specification is for the purpose of describing particular embodiments only and is not intended to limit the application. As used in this application specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.

[0021] It should also be further understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0022] As used in this specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to classification to [the described condition or event]."

[0023] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of the embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.

[0024] Many specific details are set forth in the following description in order to provide a full understanding of this application. However, this application may also be implemented in other ways different from those described herein. Those skilled in the art can make similar extensions without departing from the spirit of this application. Therefore, this application is not limited to the specific embodiments disclosed below.

[0025] This embodiment provides a data packet caching method, executed by a cache node including programmable logic and a multi-channel cache memory. The cache node is positioned between the upstream data source and the downstream device, and is used to receive, cache, and output data packets. In cross-domain Remote Direct Memory Access (RDMA) asynchronous transmission scenarios, this node can retain data that needs to be carried by intermediate devices; the cross-domain responsibility takeover protocol, the generation of acknowledgment information, and the transfer of responsibility are implemented by the accompanying transmission control unit.

[0026] Programmable logic can be implemented using a Field Programmable Gate Array (FPGA). Multi-channel cache memory can be implemented using High Bandwidth Memory (HBM), multi-channel Double Data Rate Synchronous Dynamic Random Access Memory (DDR SDRAM), on-chip Static Random Access Memory (SRAM) arrays, or a hybrid memory structure comprising several of these. Multiple parallel memory access paths include multiple data access paths for transmitting data fragments. The selected storage resources should support the corresponding multi-path parallel access and be able to locate cached data according to the descriptors and address mapping relationships described later. The above selection does not require different storage devices to have the same capacity or access performance.

[0027] In this embodiment, data packets, buffer blocks, and synchronization access units are used to organize data within packets, allocate storage space, and associate multipath access locations, respectively. A data packet descriptor records the relationship between a data packet and its corresponding buffer block; the synchronization access unit number associates data fragments of the same data packet on different paths. A data packet is the data provided by the input interface in a valid transmission cycle, while the synchronization access unit is the set of storage locations allocated for that data packet; the two are not the same physical object. The following operations are all performed using the buffer node as the execution entity, without pre-defining the division of its internal functional units.

[0028] Each buffer block contains multiple consecutively numbered synchronization access units. The same data packet can occupy one buffer block or multiple buffer blocks connected by linking information. "Consecutive" refers to the arrangement of units within a buffer block; it does not require that different buffer blocks of the same data packet be physically adjacent, nor does it require that the storage locations of the same synchronization access unit in different paths have the same numerical address.

[0029] In synchronous access units, "synchronous" means that the corresponding content in each path belongs to a single unit access, and it is not required that each path return a response at the same time. In a resource organization, a cache block is associated with a selected resource group, memory bank, and access paths within that allocation range. The location information of the cache block is used to select the corresponding range, and it is not required that a cache block cover all access paths of the memory. For consistency, this paper uses the terminology shown in Table 1 below: Table 1

[0030] Combination Figures 1 to 7 The specific implementation method is as follows: S100: Receive data packets, allocate descriptor indexes and initial buffer blocks for the data packets, and use the initial buffer blocks as the current buffer blocks.

[0031] like Figure 2 As shown, the cache node receives data packets from the upstream data source via a high-speed network interface, performs descriptor indexing and cache block allocation, data fragmentation, and parallel write processing, and stores the data in a multi-channel cache memory. The high-speed network interface specifies the application environment for data input; for example, a 400G or 800G network interface can be used, and the data packet caching method is not limited to a specific rate value. Specifically, a data fragment is a data unit belonging to the same data packet provided by the input interface within one valid transmission cycle; it can contain multiple valid bytes and corresponding valid byte markers and packet tail markers.

[0032] When a cache node detects the start of a new data packet, it allocates an available descriptor index for that packet and requests an initial cache block before writing, using this block as the current cache block. The descriptor index is used for subsequent creation and access of data packet descriptors; the initial cache block provides storage space for the first batch of data in the packet, and the two serve different purposes. When using a multi-queue organization, the cache node determines the queue corresponding to the data packet based on the data stream identifier, queue pair identifier, destination port, or priority information in the data packet or its context. The determined queue assignment is used for descriptor index enqueue processing in the S500, and the granularity of queue organization can be selected according to the application.

[0033] In one specific implementation, cache block requests are processed sequentially through a single request port. If a free cache block is not available from the selected memory bank, a new memory bank is selected and a request is initiated; after obtaining an available cache block identifier, the block is set as the current cache block. New cache block requests in the S400 can use the same process. The following description uses a configuration where each cache block contains eight synchronous access units, allocated sequentially within the block according to offsets from zero to seven. The initial block is denoted as A, and its identifier is used to obtain the corresponding memory range and unit number. Subsequent allocated cache blocks can be located in non-adjacent memory ranges to A. The eight units are an example configuration and do not limit the fixed capacity of the actual cache blocks.

[0034] S200. Establish a data packet descriptor based on the identifier of the initial cache block, record the identifier of the initial cache block as the identifier of the first cache block in the data packet descriptor, and establish the correspondence between the descriptor index and the data packet descriptor.

[0035] Specifically, using the descriptor index already allocated in S100 and the identifier of the initial block A, the cache node establishes a data packet descriptor, records the identifier of the initial cache block as the first cache block identifier in the data packet descriptor as A, and associates this descriptor with the aforementioned index. Subsequently, the descriptor can be obtained through this index, and the starting position of the packet cache space can be found through the first cache block identifier, without needing to allocate a descriptor index for the same data packet again.

[0036] To facilitate subsequent reading, cache nodes maintain management information during the write process to determine the storage location and valid data range of data packets. The following example uses the aforementioned packet descriptors and cache block descriptors to record this information: During initialization, the tail cache block identifier is set to 'A', and the packet length and the number of synchronization access units occupied are set to zero; a cache block descriptor is created for 'A', its valid range is set to empty, and the next cache block identifier is set to the end of the chain. These records are subsequently updated based on actual allocation and write progress. The creation of the descriptor only indicates that the association between the management record and the cache space has been established; it does not indicate that the packet has been written or is ready for reading.

[0037] S300: Divide each of the above data packets into multiple data fragments, allocate a synchronization access unit for the data packet from the current cache block, and associate each data fragment with the number of the synchronization access unit; and, before allocating a synchronization access unit for each data packet of the above data packet, if the synchronization access units in the current cache block have been exhausted, allocate a new cache block, record the link information from the current cache block to the new cache block, and use the new cache block as the current cache block.

[0038] Specifically, the cache node organizes the data within the received packets into data blocks according to the data width of the input interface. For each data block to be written, before allocating a synchronous access unit, it is first confirmed that there are still available units in the current cache block; if the current cache block is exhausted, the new block application, link establishment, and current block switching processes described in S400 are executed first. Subsequently, the data block is divided according to the carrying width of each parallel storage access path, and an unused synchronous access unit is allocated to it from the current cache block, so that all data fragments in the same block share the unit number. The unit allocation in S300 and the addressing and writing in S400 are performed sequentially according to the data blocks, with one data block occupying one synchronous access unit, and no duplicate allocation is made according to the number of fragments.

[0039] The following text describes the allocation, writing, reading, and recycling process using the same 1500-byte data packet. Figure 3As shown, the packet descriptor records the relationship between the packet and the cache block it occupies, the cache block descriptor records the effective synchronization access unit range of the corresponding block and the next cache block, and the synchronization access unit is used to associate the storage location of the same data packet in different parallel storage access paths. The relationship is a three-layer mapping relationship consisting of the packet descriptor layer, the cache block descriptor layer, and the synchronization access unit layer. These three layers respectively handle the functions of locating the entire packet (i.e., the complete data packet), organizing block-level space, and enabling per-pattern multi-path access.

[0040] In this numerical example, the cache node uses an FPGA in conjunction with HBM, with an input data bit width of 1024 bits, meaning each complete data clock is 128 bytes. Path 0 and Path 1 each carry a 512-bit, or 64-byte, data fragment. Path 0 corresponds to the first 64 bytes of the current clock, and Path 1 corresponds to the last 64 bytes. This correspondence remains consistent during writing and reassembly.

[0041] The aforementioned data packet is structured in twelve beats. The first eleven beats each contain 128 valid bytes, and the last beat contains 92 valid bytes, totaling 11 × 128 + 92 = 1500. Data beats can be formed and written sequentially as data is received, without needing to collect the entire data packet before the buffer begins. This bit width and path configuration is used to illustrate the processing procedure and does not require all implementations to use the same values.

[0042] The current cache block is exhausted when there are no more units available for allocation in subsequent data cycles. When a check before allocation confirms that the current block is exhausted, and there are still data cycles to be written, the cache node requests a new block. After obtaining an available new block identifier, it records the link information from the original current block to the new block, and uses the new block as the current block. Then, it allocates a synchronization access unit, a computation address, and writes data for that data cycle. If no available new block identifier is obtained, the corresponding link update and current block switch are not performed. If the current block is exhausted exactly in the last cycle, no additional new block is allocated.

[0043] like Figure 4 As shown, after recognizing a new data packet, the cache node allocates a descriptor index and an initial cache block for the packet, and accordingly establishes and initializes the data packet descriptor and cache block descriptor. The descriptor index only needs to be allocated once for this data packet and will not be re-allocated in subsequent processing cycles. For each data cycle to be written, it first checks whether there are still available synchronous access units in the current cache block. If so, a unit is allocated for this cycle so that fragments share the unit number; if not, a new block is requested, and after obtaining a valid new block identifier, a link is established and the current block is switched, and then the unit allocation and writing for this cycle are performed. New block requests occur when there are still data cycles to be written, and the last cycle exactly filling the current block will not trigger additional empty block allocation.

[0044] S400. Based on the above numbering and the preset path address mapping relationship, determine the write address of each parallel storage access path, and write each data fragment in parallel through the corresponding path.

[0045] Specifically, the cache node determines the write address of each data fragment in the corresponding path based on the synchronous access unit number allocated by S300 and the preset path address mapping relationship, and writes the data fragments in parallel through these paths. Sharing a unit number does not mean that each path uses the same actual address; the actual address is determined by the number and the mapping parameters corresponding to each path, and subsequent reads use the same mapping relationship.

[0046] A specific path address mapping relationship is as follows: the access address of each parallel memory access path is equal to the sum of the path's base address and the address offset, where the address offset is the product of the synchronization access unit number and the address interval of adjacent synchronization access units in the path. This can be expressed by the formula: Path access address = Path base address + Synchronization access unit number × Path address interval.

[0047] Here, the path base address is the starting address of the address region corresponding to the path within the selected resource range; the path address interval is the distance between the starting positions of adjacent synchronous access units within the path; and the product of the number and the interval is the offset relative to the path base address. Each path uses its own base address and interval, with the unit of the interval consistent with the unit of the access address and adapted to the storage space reserved for a unit. Thus, fragments associated with the same number can be located at the storage locations of their respective paths, and these locations can be returned during reads according to the same relationship.

[0048] In the implementation of intra-block offset location, the cell number is equal to the sum of the cache block's starting cell number and the intra-block offset. The intra-block offset starts from zero and increments with the data allocation order; when transferring to a new block, the new block's starting cell number and intra-block offset are used. If the new block is located in a different resource range, the appropriate access path and base address are selected simultaneously based on the new block's location information, preventing the same numerical value in different resource ranges from being mistakenly identified as the same storage cell.

[0049] In the 1500-byte data packet example, the first eight blocks sequentially use eight units from block A. When preparing to write to the ninth block, block A is exhausted, so block B is allocated, a link is established between block A and block B, and writing continues from the first unit of block B. From the ninth to the twelfth block, four units in block B, offset from zero to three, are sequentially used. Block B serves as the tail block of the packet, and no other buffer blocks are linked thereafter.

[0050] like Figure 3As shown, data packet A is 1500 bytes long, arranged in twelve blocks of 128 bytes each. In the example where each block contains eight synchronization access units, data packet A uses all eight units of buffer block A and the first four units of buffer block B. Its packet descriptor records that the first block is A, the last block is B, and the total number of synchronization access units is twelve; the block descriptor of A points to B, and the next block identifier of B indicates the end of the chain. Data packet B uses buffer block C independently, and its block chain is unrelated to data packet A; therefore, no link information is set between B and C. Figure 3 In this context, `valid_slot_count` represents the number of valid synchronized access units. NULL indicates an empty link or a chain end marker, meaning there is no next cache block; its actual encoding is not required to be 0.

[0051] To demonstrate address calculation, assume that A and B are located within the same resource range allocated in this instance, with starting unit numbers 32 and 8 respectively. All paths are addressed byte-wise, with address intervals of 64 bytes. The first cycle, number 32, corresponds to an offset of 2048 bytes, while the ninth cycle uses number 8, corresponding to an offset of 512 bytes. Each offset is then added to its corresponding path's base address to obtain the actual access address.

[0052] like Figure 3 As shown, 0 to 7 in the grid represent offsets within the block, slashes represent valid synchronized access units, and blank spaces represent unused units within the allocated cache block. Unit numbers for cache A are 32 to 39, and valid unit numbers for cache B are 8 to 11. When reading data packet A, A and B are accessed sequentially, without prioritizing B due to its smaller number. Different cache blocks do not need to be physically adjacent. Reading and reclaiming both locate the same cache block chain through descriptors. Only the valid range of the last block is read; resource reclamation returns the entire block, including unused units from the last block. Figure 3 In this context, a "cell" is a collection of multipath storage locations, not a single fragment located on a single path.

[0053] During the above write process, the cache node also saves the valid bytes and packet boundary information corresponding to the data, for restoring valid data and packet boundaries during reading. The following example uses a metadata-based approach to obtain and separately save this per-episode information, and uses information such as the number of valid bytes to maintain the management records of data packets and cache blocks. The former describes the saving of per-episode information, and the latter describes the records of storage location, valid range, and links. Both sets of processing are integrated into the above write process; the maintenance of descriptor fields does not require setting a separate metadata access path. Specifically, this includes: For each of the above data snapshots, obtain the corresponding metadata.

[0054] Specifically, for each data packet to be written, the cache node obtains the metadata corresponding to that packet based on the valid byte information and packet boundary information provided by the input interface. The valid byte marker indicates which bytes in that packet constitute valid data packet content, and the packet tail marker indicates whether that packet is the last packet. The metadata may also include supporting information such as packet sequence number or byte count.

[0055] The addition here is the acquisition and storage of information associated with each snapshot. The aforementioned data snapshot division, segment correspondence, and unit allocation continue to apply. A new set of synchronous access units unrelated to its data segmentation will not be allocated for the same snapshot.

[0056] The data fragments of the aforementioned data snapshot are used as payload fragments and written to different address areas along with the aforementioned metadata via different parallel storage access paths. The two are then associated with the same synchronous access unit number allocated to the aforementioned data snapshot.

[0057] Specifically, the data fragments obtained from the data partitioning are used as the payload, and the acquired metadata is configured with access paths and address regions different from those of the payload. Both the payload fragments and the metadata are associated with the same synchronization access unit number already assigned to that snapshot, and each path determines its write location based on this number and corresponding mapping parameters. In this way, although the content is stored separately, the correspondence within the same data snapshot is still preserved.

[0058] In the configuration where the two 512-bit paths carry 1024 bits of data, paths 0 and 1 continue to store payload fragments, while path 2 stores metadata in a 512-bit access word. The third path carries additional supporting information and is not a third payload segment cut from the 1024 bits of data. Metadata is not counted as valid bytes in the packet length.

[0059] For a 1500-byte data packet, the first eleven frames each contain 128 valid bytes and the packet has not yet reached its end; in the last frame, 64 bytes of path 0 are valid, the first 28 bytes of path 1 are valid, and the remaining 36 positions are invalid. The corresponding valid byte markers and packet end markers are saved as shown in Table 2 below for use in the S600 read recovery: Table 2

[0060] Separate writing allows the payload and accompanying information to be stored in different areas; sharing the unit number ensures that the separate contents have a definite correspondence and location basis. The recovery of valid bytes and packet tails also requires obtaining and using these markers during reading, and the corresponding processing is described in S600.

[0061] like Figure 5As shown, in the specific configuration of metadata-separated storage, a 1024-bit data packet is divided into two 512-bit payload fragments, written via path 0 (lane0) and path 1 (lane1) respectively. Metadata such as the keep flag and end of packet (EOP) for this packet are written via path 2 (lane2). Path 2 stores additional supporting information; it is not a third payload fragment divided from the 1024-bit data packet, nor is it included in the effective byte length of the data packet. The two payload fragments and their metadata are associated with the same synchronization access unit number s. After selecting the corresponding storage resource range, the cache node determines the access address based on the base address of each path, the number, and the address interval of that path. Figure 5 The example directly uses s as the linear address index, and the address of path i is "Addr_i = Base_i + s × Stride_i". i is the path number, which in this embodiment is 0, 1, or 2; s represents the synchronization access unit number; in Figure 5 In the formula, these are also used as linear address indices. Addr_0, Addr_1, and Addr_2 represent the access addresses of the synchronization access unit s in paths 0, 1, and 2, respectively; Addr is an address variable marker. Base_0, Base_1, and Base_2 represent the path base addresses of paths 0, 1, and 2 within the selected resource range, respectively; Base represents the base address. Stride_0, Stride_1, Stride_2, and Stride_i correspond to the address intervals between adjacent synchronization access units in the path; Stride represents the address step size, and the unit must be consistent with the access address. Figure 5 The common association line connecting the three storage areas only indicates a numbered association and does not indicate that data is moved between the areas.

[0062] For the last frame of a 1500-byte data packet, the 64 bytes of path 0 and the first 28 bytes of path 1 are valid, while the remaining 36 positions of path 1 are invalid; path 2 stores the corresponding valid byte markers and packet end markers. Reading uses the numbering and mapping from when it was written, reassembles the data according to the original fragmentation relationship, and restores the valid bytes and end boundary based on the corresponding markers.

[0063] Maintaining management records for data packets and cache blocks may specifically include: Based on the number of valid bytes written to the data packet, the identifier of the buffer block used, and the number of synchronization access units occupied, update the packet length, tail buffer block identifier, and number of synchronization access units in the above packet descriptor.

[0064] Specifically, during parallel writing, the data packet length is accumulated based on the number of valid bytes written in each phase, which is used to represent the total amount of valid data in the packet; the first buffer block identifier is kept as record A in S200. The tail buffer block identifier is initially A, and is updated to B when B is accessed and used for continuation writing, which is used to identify the end of the current block chain.

[0065] The number of synchronization access units occupied is accumulated based on the units actually allocated and used for the packet, increasing by one unit for each clock cycle, without repeating the count according to the number of fragments in that cycle. For the above data packet, after writing in the first eight clock cycles, the packet length is 1024 bytes and the number of units is eight; after writing in the twelfth clock cycle, the packet length is 1500 bytes and the number of units is twelve. Saved metadata and invalid positions in the last clock cycle do not increase the packet length.

[0066] Maintain a cache block descriptor for each cache block, record the range of valid synchronous access units and the aforementioned link information, so as to determine the read range of each cache block and the next cache block during the aforementioned parallel read.

[0067] Specifically, a cache block descriptor is maintained for each cache block occupied by the data packet, recording the valid synchronization access unit range of the corresponding block and the link to the next block. In the implementation that writes continuously starting from offset zero within the block, the range can be represented by the number of valid units: when the number is four, offset zero to three is valid; when the number is eight, offset zero to seven is valid. The valid range of each block is updated as it is actually written; when a new block is accessed, the next block identifier of the current block is updated to the new block identifier, and the next block identifier of the new tail block is the end of the chain.

[0068] During reading, the cache node obtains the valid units in each block and the location of the next block based on these records; the corresponding resource group, storage bank, and address location information are used to select the actual storage range occupied by the block. The packet descriptor provides the access entry point for the entire packet, and the block descriptor provides the local valid range and link. Together, they deliver the write results to subsequent reads, avoiding the reading of invalid units when the last block is not full.

[0069] When organizing packet queues of the same data stream in a chained manner, packet descriptors can also record the index of the next packet descriptor. This index connects different packets in the same stream, while the next buffer block in the block descriptor identifies the storage space connecting the same packets; when reading or releasing a packet, the latter is traversed, and buffer blocks of other packets are not released along the inter-packet queue relationship.

[0070] Using the initialization results from S100 and S200, the effective range of block A is initially empty. After each write operation, the effective range of this block is updated, and the packet length and number of units are updated according to the maintenance and management information method described above. When block B is accessed, block B is recorded in the cache block descriptor of block A, and the tail block identifier is updated in the packet descriptor. Therefore, the packet length, effective range, and link in the descriptor are all based on the actual write or allocation results, and are used in S600 to locate and determine the read range. Subsequent resource reclamation can also use this block chain, so that reading and reclamation correspond to the same set of actually occupied cache blocks.

[0071] S500: After the above data packet is written and the write completion feedback is received, add the above descriptor index to the queue.

[0072] Specifically, only after all data fragments of the packet have been written and the required write completion feedback for the packet has been received will the cache node mark the packet as readable and add its descriptor index to the output queue. When using the multi-queue organization described above in S100, the index is added to the corresponding queue according to the determined queue affiliation. The index is not committed if only the end of the packet is received, only space allocation is completed, or there are still write operations for this packet that have not been completed.

[0073] When using a metadata-based separate write approach, the write completion feedback must simultaneously cover the payload and associated metadata. Taking the aforementioned twelve-shot data packet as an example, after the last shot's reception and write processing are completed, it is still necessary to wait for the necessary feedback that has not yet arrived; only after the payload and metadata in all three paths have been written can the packet be indexed and queued.

[0074] The queue stores descriptor indices, while the data packet content remains in the original cache block chain. This enqueue condition ensures that subsequent data packets selected from the queue have already completed the required writing, avoiding premature reading of incomplete data; the queue operation itself does not require moving data packet content.

[0075] S600. Take the descriptor index of the data packet to be output from the queue, read the corresponding data packet descriptor, determine the synchronization access unit to be read according to the first buffer block identifier and the above link information, generate the read address according to the same path address mapping relationship as when writing, read the data fragments of the same synchronization access unit in parallel, reassemble and output them according to the data sequence of the above data packets.

[0076] Specifically, the cache node retrieves the descriptor index of the data packet from the output queue; when using a multi-queue organization, it retrieves the index from the selected sendable queue. Based on this, the cache node reads the data packet descriptor, obtains the first cache block identifier, and determines the cache block occupied by the packet and the effective synchronization access unit range according to the management information formed during the write phase. In the above example, using the records formed by maintaining the management information, the effective unit range and the next block identifier in each cache block descriptor are obtained sequentially, the number of the unit to be read is determined, and then the path read addresses are generated according to the same path address mapping relationship as during the write phase.

[0077] Within the same block, valid cells are processed according to the order in which data is written. After the valid range of a block is processed, the process moves along the link to the next block until the end of the link. When the last block is only partially used, only its valid range is read. The cross-block reading order is determined by the link relationship, not by comparing physical addresses or cell numbers.

[0078] For the same synchronous access unit, data fragments from each path are read in parallel, and concatenated into a data frame according to the fragment arrangement determined by S300. Then, the data frames are output in the original data packet data frame order. For the configurations of path 0 and path 1, the first half and the second half of the frame are retrieved respectively and concatenated in the original order. In this way, the cross-block order is first determined by the block chain, then the access unit is determined by the effective range within the block, and finally the fragment arrangement within the same unit is restored.

[0079] In conjunction with metadata-based separate writing, the cache node also retrieves the corresponding metadata based on the same synchronous access unit number, determines the valid bytes in the concatenation result based on the valid byte marker, restores the end boundary based on the packet tail marker, and marks the start of the data packet during the first output. For information in the metadata, such as the packet sequence number, which needs to be used for subsequent output processing, its association with the corresponding data packet is maintained and provided to the output processing part as sideband information. Metadata is not fragmented into the data packet as payload, and positions not marked as valid are not output as valid bytes of the data packet. The above processing uses the correspondence established during writing.

[0080] like Figure 6 As shown, the cache node retrieves the descriptor index from the output queue and determines the block chain, the valid range within the block, and the unit number to be read based on the packet descriptor and the cache block descriptor. Read requests are organized according to the block chain order and the data sequence within the block, and parallel read requests are initiated to each path corresponding to the same synchronous access unit based on the address mapping used during writing. Requests can be organized according to the processing progress; it is not required that all read requests for the entire packet be issued at once before output begins.

[0081] The aforementioned numbering and mapping determine the storage ownership of the fragments, but the return times of each path may differ. To address the return time difference, further temporary storage, alignment, and order preservation processing are employed; these operations are integrated into the parallel reading and reassembly process of this step.

[0082] Based on the data packet sequence, read requests are sent to each synchronous access unit, and read requests are simultaneously initiated to each parallel storage access path corresponding to the same synchronous access unit.

[0083] Specifically, the cache node determines the read request order of each synchronous access unit according to the order in which the data within the packet is captured, and initiates read requests simultaneously for each path of the same unit. When each path returns, the first arriving fragment is saved in the corresponding temporary register, and its correspondence with the read request, unit number, and path is maintained to prevent fragments from different data captures from being mixed together.

[0084] This correspondence can be maintained using the saved request association information. It does not require the memory return message itself to carry the unit number in a fixed format, nor does it require that each path has the same return delay. After all data fragments belonging to the same synchronous access unit are returned, they are spliced ​​together according to the fragment correspondence specified in S300 to obtain the data frame corresponding to that unit; if the fragments of that unit are not yet complete, incomplete data frames are not output in advance.

[0085] When using a metadata separation approach, the corresponding metadata for the unit must be obtained before output. Based on the synchronization access unit number allocated to the data frame, the payload fragments and corresponding metadata are retrieved from the aforementioned different address areas. Then, the data fragments are concatenated according to the fragment correspondence at the time of writing, and the valid bytes and data packet boundaries are restored based on the valid byte markers and packet tail markers in the aforementioned metadata, ensuring that the data content and the restored markers correspond to the same frame.

[0086] The returned data fragments are temporarily stored according to their corresponding synchronous access units. After all data fragments in the same synchronous access unit are returned, all the data fragments are reassembled into the corresponding data blocks. When a later data block is read out before an earlier data block, the later data block is temporarily stored. After all the data blocks before the later data block are output, the later data block is output.

[0087] Specifically, cache nodes issue read requests in the order of the block chain and the order of valid units within a block, ensuring that the request order matches the order in which the data is processed within the packet. When a unit corresponding to a later request completes its read operation first, its data is temporarily stored and output only after the data preceding it has been processed. This rule continues to be followed when crossing blocks, and the order within the packet is not changed due to smaller subsequent block addresses or earlier responses.

[0088] The processing is divided into two levels: fragments within the same unit are reassembled after all fragments are complete, while data from different units is output in the order of data snapshots. When a later data snapshot is read before an earlier data snapshot, the later data snapshot is temporarily stored. It is then output only after all data snapshots preceding it have been output. These two methods, in conjunction with the fragment arrangement during writing and the block chain traversal during reading, respectively prevent premature output of incomplete fragments and data snapshot reversal caused by response time differences. When metadata is stored separately, a corresponding marker is also used for output recovery of that snapshot.

[0089] In the 1500-byte example, fragments 32 to 39 of packet A are processed first, followed by fragments 8 to 11 of packet B. If fragment 1 of path 1 returns first, fragment 0 returns next, and metadata of path 2 returns last in packet 8, the first fragment to arrive is temporarily stored, and output once all required content for that packet is available. If fragments and metadata for packet 9 are available before packet 8 has been output, packet 9 is temporarily stored until packet 8 is output, at which point packet 9 is output. Changing the number from 39 to 8 and the order of path responses do not change the packet order.

[0090] During output, the first eleven packets each provide 128 valid bytes; the last packet provides 64 bytes for path 0 and 28 bytes for path 1, marked with a packet end flag. The remaining 36 invalid locations in path 1 and the metadata access words in path 2 are not included in the packet content, resulting in a total of 1500 bytes of recovered valid data. The mapping between separate storage is used here for recovering valid bytes and packet end, not just for locating the two storage areas separately.

[0091] After the entire packet is output, cache resource reclamation can proceed: based on the first cache block identifier in the packet descriptor, release each cache block occupied by the packet sequentially along the link information. After all cache blocks have been released, invalidate the packet descriptor and reclaim the corresponding descriptor index. Output completion is a prerequisite for this reclamation; merely reading the memory contents does not equate to the entire packet being output. If downstream confirmation is not required, the above reclamation can be performed after the entire packet is output; if unacknowledged data needs to be retained, an acknowledgment waiting condition is added according to the reclamation scheme below.

[0092] For implementations requiring acknowledgment waiting, a responsibility status and acknowledgment coverage flag are also configured in the established packet descriptor. The responsibility status indicates the cache responsibility stage, such as pending transmission or acknowledgment waiting, while the acknowledgment coverage flag indicates the downstream acknowledgment coverage status of the packet. Packets that have not yet received acknowledgment when the descriptor is established are marked as unacknowledged; packets are in a pending transmission state after being added to the queue according to their descriptor index. These fields control when existing cached resources are released without changing the storage location or block chain relationship of data fragments. Specifically, they include: After the above data packet is output, the above responsibility status is updated to confirmation waiting status, and the buffer block occupied by the above data packet and the corresponding data packet descriptor are retained.

[0093] Specifically, after a cache node confirms that the packet has been completely output, it updates its responsibility status from "Pending Send" to "Confirmation Waiting," and continues to retain the packet descriptor, all occupied cache blocks, and inter-block link information. At this point, only the responsibility status is changed; block release or index reclamation is not performed, nor is the migration of the saved payload required.

[0094] Even after retaining these records, the packet can still be located using the original descriptor index, first block identifier, and block chain. The end of the current use of the temporary register, or the complete reading of a cache block, does not necessarily mean that the resource release condition awaiting confirmation has been met.

[0095] The aforementioned confirmation overlay flag is updated based on the downstream confirmation information, and the aforementioned cache resource reclamation is performed only when the aforementioned confirmation overlay flag indicates that the entire data range of the aforementioned data packet has been confirmed to be received by the downstream.

[0096] Specifically, the supporting transmission control section provides downstream acknowledgment information that can be associated with the packet, and the cache nodes update the acknowledgment overwrite flag in the original packet descriptor accordingly. When data has not yet been acknowledged or only part of the data has been acknowledged, the entire cache block and descriptor of the packet are retained; cache resource reclamation is only triggered when the packet has been output and the overwrite flag indicates that the entire packet has been acknowledged. This process uses the acknowledgment overwrite result and does not separately specify the acknowledgment message encoding, acknowledgment generation algorithm, or responsibility transfer protocol.

[0097] During recycling, the current block is first retrieved based on the first block identifier. Before releasing the current block, the identifier of its next block is saved. Then, the current block is returned to the free cache block resource, and the next block is processed, until the chain ends. Unused units in the last block are returned along with the entire block. Only after all cache blocks are released are the packet descriptors invalidated and their indexes reclaimed to avoid losing the location reference before the block chain traversal is completed.

[0098] like Figure 7 As shown, resource reclamation is conditional upon the complete output of the entire packet. For implementations that do not require downstream confirmation, cache block reclamation can begin after the entire packet is output; for implementations that require downstream confirmation, the responsibility status is first updated to confirmation waiting, and all cache blocks, data packet descriptors, and related location information of the packet are retained, and then the confirmation overwrite flag is updated based on subsequent confirmation information.

[0099] Taking the above data packet as an example, if the confirmation information has not yet covered the entire 1500-byte packet, no block will be released even if A has finished reading or B has only used half of it. After all confirmations are made, the next block B of A is obtained, A is released, then B is released, and the four unused units in B are returned with the block; subsequently, the packet descriptor is invalidated and the index is returned.

[0100] If the aforementioned non-confirmation-waiting recycling method is adopted, the actions of releasing along the path from A to B, and finally invalidating the descriptor and recycling the index remain unchanged. The triggering condition is changed to the completion of the entire packet output; outputting only the 8th clock cycle does not constitute a complete packet recycling condition. The difference between the two methods lies in the release timing; the confirmation waiting method is different, and the processing of unconditional release upon completion of output is executed simultaneously.

[0101] Through the aforementioned confirmation waiting and reclamation processes, the packet descriptor, descriptor index, and cache block chain remain valid even when confirmation coverage is insufficient. After the supporting transmission control unit determines which packets need to be read again, the cache node can obtain the packet descriptor through the original descriptor index of that packet, reuse the cache block for location, parallel reading, and reassembly processing, without needing to retrieve the index again from the output queue used in the initial transmission. The triggering of the re-read and the range to be read are determined by the supporting transmission control unit; this embodiment does not specify a selective retransmission strategy. After all packets are confirmed, the occupied resources are released along the same cache block chain, and finally, the descriptor is invalidated and the index is reclaimed.

[0102] Based on the above embodiments, this application also provides a terminal, the principle block diagram of which can be as follows: Figure 8 As shown. The terminal includes a processor, memory, network interface, and display screen connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When the computer program is executed by the processor, it implements the steps of any of the above-described data packet caching methods. The display screen can be a liquid crystal display (LCD) or an electronic ink display.

[0103] Those skilled in the art will understand that Figure 8 The block diagram shown is only a partial structural diagram related to the solution of this application and does not constitute a limitation on the terminal on which the solution of this application is applied. The specific terminal may include more or fewer components than shown in the figure, or combine some components, or have different component arrangements.

[0104] In one embodiment, a terminal is provided, the terminal including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of any of the data packet caching methods provided in the embodiments of this application.

[0105] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of any of the data packet caching methods provided in this application.

[0106] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0107] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the above device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above device can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0108] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0109] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0110] In the embodiments provided in this application, it should be understood that the disclosed systems / terminal devices and methods can be implemented in other ways. For example, the system / terminal device embodiments described above are merely illustrative. For instance, the division of modules or units described above is merely a logical functional division, and in actual implementation, it can be divided in other ways. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0111] If the integrated modules / units described above are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, and software distribution media, etc. It should be noted that the content included in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction.

[0112] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions are not in essence a departure from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A data packet caching method, characterized in that, The method is applied to a cache node with multiple parallel storage access paths, including multiple data access paths for transmitting data fragments. The method includes parallel writing of data fragments and parallel reading, reassembly, and output of data fragments. The parallel writing of data fragments includes: Receive a data packet, allocate a descriptor index and an initial cache block to the data packet, and use the initial cache block as the current cache block; A data packet descriptor is established based on the identifier of the initial cache block. The identifier of the initial cache block is recorded in the data packet descriptor as the identifier of the first cache block. A correspondence between the descriptor index and the data packet descriptor is established. Each cache block contains multiple consecutive synchronous access units, and each synchronous access unit includes multiple storage locations that correspond one-to-one with the multiple data access paths. Each data segment of the data packet is divided into multiple data fragments. A synchronization access unit is allocated for each data segment from the current cache block, and each data fragment is associated with the number of the synchronization access unit. Before allocating a synchronization access unit for each data segment of the data packet, if the synchronization access units in the current cache block are exhausted, a new cache block is allocated, the link information from the current cache block to the new cache block is recorded, and the new cache block is used as the current cache block. Based on the number and the preset path address mapping relationship, the write address of each parallel storage access path is determined, and each data fragment is written in parallel through the corresponding path. After the data packet is written and a write completion feedback is received, the descriptor index is added to the queue; The parallel reading, reassembly, and output of the data fragments include: retrieving the descriptor index of the data packet to be output from the queue, reading the corresponding data packet descriptor, determining the synchronous access unit to be read based on the first cache block identifier and the link information, generating a read address according to the same path address mapping relationship as when writing, reading the data fragments of the same synchronous access unit in parallel, reassembling and outputting them according to the data packet order.

2. The data packet caching method according to claim 1, characterized in that, The step of writing each data fragment in parallel via its corresponding path further includes: For each data snapshot, obtain the corresponding metadata, wherein the metadata includes a valid byte marker and a packet end marker; The data fragments of the data packet are used as payload fragments and written to different address areas along with the metadata via different parallel storage access paths. The two are associated with the same synchronous access unit number allocated to the data packet. The write completion feedback covers the writing of the payload fragments and corresponding metadata of the data packet.

3. The data packet caching method according to claim 1, characterized in that, The path address mapping relationship is as follows: the access address of each parallel storage access path is equal to the sum of the base address of the path and the address offset, wherein the address offset is the product of the synchronous access unit number and the address interval of the adjacent synchronous access units in the path.

4. The data packet caching method according to claim 1, characterized in that, The method further includes: Update the packet length, tail buffer block identifier, and number of synchronization access units in the packet descriptor based on the number of valid bytes of the written data, the cache block identifier used, and the number of synchronization access units occupied. Maintain a cache block descriptor for each cache block, record the range of valid synchronous access units and the link information, so as to determine the read range of each cache block and the next cache block during the parallel read.

5. The data packet caching method according to claim 1, characterized in that, The parallel reading, reassembly, and output of the data fragments include: Read requests are sent to each synchronous access unit according to the data packet's data sequence, and read requests are simultaneously initiated to each parallel storage access path corresponding to the same synchronous access unit. The returned data fragments are temporarily stored according to their corresponding synchronization access units, and after all data fragments of the same synchronization access unit have been returned, the all data fragments are reassembled into the corresponding data fragments; and, When a subsequent data frame is read out before an earlier data frame, the subsequent data frame is temporarily stored. The subsequent data frame is then output after all data frames preceding it have been output.

6. The data packet caching method according to claim 2, characterized in that, During the parallel reading and reassembly of the data fragments, the payload fragments and corresponding metadata are obtained from the different address regions according to the synchronization access unit number assigned to the data fragment. The data fragments are assembled according to the fragment correspondence at the time of writing, and the valid bytes and data packet boundaries are restored according to the valid byte markers and packet tail markers in the metadata.

7. The data packet caching method according to any one of claims 1 to 6, characterized in that, After the data packet is reassembled and output, cache resource reclamation is performed, which includes: Based on the first cache block identifier in the packet descriptor, release each cache block occupied by the packet sequentially along the link information; After all the cache blocks have been released, the packet descriptor is invalidated and the corresponding descriptor index is reclaimed.

8. The data packet caching method according to claim 7, characterized in that, The packet descriptor also records the responsibility status and the acknowledgment overlay flag. The responsibility status is used to indicate whether the buffer resources of the packet need to be retained. The acknowledgment overlay flag is used to indicate the range of data in the packet that has been acknowledged by the downstream. After the data packet is output, the responsibility status is updated to the confirmation waiting status, and the buffer block occupied by the data packet and the corresponding data packet descriptor are retained; The confirmation overlay flag is updated based on the downstream confirmation information, and the cache resource reclamation is performed only when the confirmation overlay flag indicates that the entire data range of the data packet has been confirmed to be received by the downstream.

9. A terminal, characterized in that, The terminal includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the packet caching method as described in any one of claims 1 to 8.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the data packet caching method as described in any one of claims 1 to 8.