Resource management apparatus and resource management method

TWI945678BActive Publication Date: 2026-11-11AIROHA TECH (SUZHOU) LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
TW114102221
Authority / Receiving Office
TW · TW
Patent Type
Patents
Current Assignee / Owner
Priority Date
2024-12-31
Filing Date
2025-01-20
Publication Date
2026-11-11
Estimated Expiration
2045-01-19

AI Technical Summary

Technical Problem

Existing network processing units (NPUs) face challenges in efficiently managing resource identifiers due to operational overhead, which affects packet forwarding performance as network bandwidth increases.

Method used

A multi-layer architecture is employed using DRAM for storage, SRAM as a buffer, and the processor's internal memory as cache to manage resource identification codes, with a resource management circuit handling prefetch and pre-return operations to optimize resource allocation and release.

Benefits of technology

This approach reduces operational overhead by efficiently managing resource identifiers, maintaining high-speed packet processing without significant fluctuations, even under varying network conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure TWG2TB001920430_001
    Figure TWG2TB001920430_001
  • Figure TWG2TB001920430_002
    Figure TWG2TB001920430_002
  • Figure TWG2TB001920430_003
    Figure TWG2TB001920430_003
Patent Text Reader

Abstract

This invention provides a resource management device, comprising a processor, a resource management circuit, and a second memory. The processor has internal memory. The resource management circuit has a first memory, wherein the access speed of the first memory is higher than the access speed of the second memory. The resource management circuit is configured to load a plurality of first resource identification codes stored in the second memory into the first memory, and return a plurality of second resource identification codes stored in the first memory to the second memory; and the resource management circuit is further configured to load a plurality of third resource identification codes stored in the first memory into the internal memory, and return a plurality of fourth resource identification codes stored in the internal memory to the first memory.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to resource identification code management, and more particularly to a resource management device and method that employs a multi-layer architecture to perform resource identification code management. Prior Technology

[0002] A network processing unit (NPU) is a high-speed programmable processor specifically designed for network packet processing (e.g., network packet forwarding). It has features and architectures to accelerate network packet processing efficiency. However, with the continuous increase in network bandwidth, network packets are transmitted at higher rates, requiring the NPU to also be able to quickly process these high-speed incoming network packets. In addition, the packet forwarding process frequently requires the use of various resources, and the use of resources will cause a certain degree of operational overhead. Generally, resource usage can be implemented through resource identifiers. How to quickly and efficiently manage a large number of resource identifiers to avoid the operational overhead of resources affecting packet forwarding performance has become an important issue. Summary of the Invention

[0003] One of the objectives of this invention is to provide a resource management device and method that employs a multi-layer architecture to perform resource identification code management.

[0004] In one embodiment of the present invention, a resource management device is disclosed. The resource management device includes a processor, a resource management circuit, and a second memory. The processor has an internal memory. The resource management circuit has a first memory, wherein the access speed of the first memory is higher than the access speed of the second memory. The resource management circuit is configured to load a plurality of first resource identification codes stored in the second memory into the first memory, and return a plurality of second resource identification codes stored in the first memory to the second memory; and the resource management circuit is further configured to load a plurality of third resource identification codes stored in the first memory into the internal memory, and return a plurality of fourth resource identification codes stored in the internal memory to the first memory.

[0005] In one embodiment of the present invention, a resource management method is disclosed. The resource management method includes: loading a plurality of first resource identifiers stored in a second memory into the first memory, wherein the access speed of the first memory is higher than the access speed of the second memory; returning a plurality of second resource identifiers stored in the first memory to the second memory; loading a plurality of third resource identifiers stored in the first memory into an internal memory of a processor; and returning a plurality of fourth resource identifiers stored in the internal memory to the first memory.

[0006] This invention employs a multi-layered architecture to manage resource identification codes. The system memory (e.g., DRAM) has a large storage capacity and can therefore store all resource identification codes. The memory of the resource management circuit (e.g., SRAM) serves as a buffer, with a faster access speed than the system memory (e.g., DRAM), and can store only a portion of the resource identification codes. Furthermore, the processor's internal memory is cache memory, which has the fastest access speed and can store only a smaller amount of resource identification codes. Simple Explanation of the Diagram

[0007] Figure 1 is a schematic diagram of a resource management device according to an embodiment of the present invention. Figure 2 is a flowchart of the operation of the resource management circuit in processing resource identification code request requests from the processor. Figure 3 is a schematic diagram of a resource management circuit performing a prefetch operation in Case 1 according to an embodiment of the present invention. Figure 4 is a schematic diagram of a resource management circuit performing a prefetch operation in Case 2 according to an embodiment of the present invention. Figure 5 is a flowchart of the operation of the resource management circuit in processing the resource identification code release request from the processor. Figure 6 is a schematic diagram of the resource management circuit of an embodiment of the present invention performing a pre-backfill operation in Case 1. Figure 7 is a schematic diagram of the resource management circuit of an embodiment of the present invention performing a pre-backfill operation in Case 2. Implementation

[0008] Certain terms are used in this specification and the claims to refer to specific components. Those skilled in the art will understand that hardware manufacturers may use different names to refer to the same component. This specification and the claims do not distinguish components by name differences, but by functional differences. The terms "comprising" and "including" used throughout this specification and the claims are open-ended and should be interpreted as "comprising but not limited to." Furthermore, the terms "coupled" or "coupled" herein include any direct and indirect electrical connection means. Therefore, if a first device is described as coupled to a second device, it means that the first device can be directly electrically connected to the second device, or indirectly electrically connected to the second device through other devices and connection means.

[0009] Figure 1 is a schematic diagram of a resource management device according to an embodiment of the present invention. For example (but not limited thereto), the resource management device 100 can be applied to network devices, such as gateways. The resource management device 100 includes a memory 102, a resource management circuit 104, and a processor 106, wherein the resource management circuit 104 has a memory 108, and the processor 106 has an internal memory 110. For example, the memory 102 is dynamic random access memory (DRAM), and the memory 108 and the internal memory 110 are both static random access memory (SRAM). For the processor 106, the internal memory 110 can be used as cache memory, thus having the fastest access speed, while both the memory 102 and the memory 108 are external memory, wherein the access speed of the memory 108 is higher than that of the memory 102. Additionally, processor 106 can be a network processor, and resource management circuit 104 can be pure hardware supporting resource identifier management, used to manage the resource identifiers to be used by processor 106. For example, when a packet buffer is initialized, it is divided into multiple storage blocks according to a fixed block size. These storage blocks in the packet buffer are used to store multiple network packets respectively. In addition, each storage block in the packet buffer is configured with a unique resource identifier Buf-ID. Therefore, processor 106 can perform network packet forwarding through the resource identifier Buf-ID. Please note that this is only an example and is not intended to limit the invention. In other applications, the resource identifier can be an identifier of other resource categories (e.g., token-ID). In other words, any device and method that uses the multi-layer architecture disclosed in this invention to perform resource identifier management falls within the scope of this invention.

[0010] To facilitate the explanation of the technical features of the present invention, it is assumed below that the resource identification code to be managed by the resource management circuit 104 is Buf-ID. In this embodiment, the memory 102 will be divided into a plurality of storage blocks 112_1 to 112_M ( ), memory 108 will be divided into multiple storage blocks 114_1~114_N ( ), and the internal memory 110 will be divided into at least one storage block 116_1~116_R ( Storage blocks 112_1~112_M and storage blocks 114_1~114_N may have the same block size (e.g., 128B), however, the number of storage blocks 112_1~112_M may be greater than the number of storage blocks 114_1~114_N (i.e., Furthermore, the block size of each storage block in storage blocks 114_1~114_N (e.g., 128B) will be larger than the block size of each storage block in storage blocks 116_1~116_R (e.g., 16B), and the number of storage blocks 114_1~114_N will be greater than the number of storage blocks 116_1~116_R (that is, For example, the ID value of each resource identifier Buf-ID is represented using 16 bits. During initialization, the array of resource identifier Buf-IDs is divided into multiple arrays of 64 resource identifier Buf-IDs (occupying 128B), and stored in storage blocks 112_1 to 112_M respectively. That is, each storage block in storage blocks 112_1 to 112_M stores one group (64) of resource identifier Buf-IDs. Assuming that the resource management device 100 supports 32K resource identifier Buf-IDs (with index values ​​Buf-ID_index of 0, 1, 2, 3, …, 32767 respectively), it can be divided into 512 groups. Therefore, the number of storage blocks 112_1 to 112_M is 512 (that is, M=512). Regarding the memory 108 in the resource management circuit 104, each storage block in storage blocks 114_1 to 114_N stores a set (64) of resource identification codes Buf-ID. In this embodiment, the number of storage blocks 114_1 to 114_N is 16 (i.e., N=16). In addition, the 64 resource identification codes Buf-ID stored in each storage block in storage blocks 114_1 to 114_N can be further divided into 8 batches, each batch containing 8 resource identification codes Buf-ID. Regarding the internal memory 110 of the processor 106, each storage block in storage blocks 116_1 to 116_R stores a batch (8) of resource identification codes Buf-ID.

[0011] Resource management circuit 104 is used to load a plurality of resource identification codes stored in memory (e.g., DRAM) 102 into memory (e.g., SRAM) 108, and return the plurality of resource identification codes stored in memory (e.g., SRAM) 108 to memory (e.g., DRAM) 102; in addition, resource management circuit 104 is also used to load a plurality of resource identification codes stored in memory (e.g., SRAM) 108 into internal memory (e.g., SRAM) 110 of processor 106, and return the resource identification codes stored in internal memory (e.g., SRAM) 110 of processor 106 to memory (e.g., SRAM) 108. In this embodiment, when a specific condition is met, the resource management circuit 104 automatically performs a prefetch operation to load a plurality of resource identification codes stored in memory (e.g., DRAM) 102 into memory (e.g., SRAM) 108; when another specific condition is met, the resource management circuit 104 automatically performs a pre-return operation to return the plurality of resource identification codes stored in memory (e.g., SRAM) 108 to memory (e.g., DRAM) 102; In response to a resource allocation request issued by the processor 106, the resource management circuit 104 loads a plurality of resource identifiers stored in memory (e.g., SRAM) 108 into the internal memory (e.g., SRAM) 110 of the processor 106; and in response to a resource allocation request issued by the processor 106, the resource management circuit 104 returns the resource identifiers stored in the internal memory (e.g., SRAM) 110 of the processor 106 to memory (e.g., SRAM) 108.

[0012] In this embodiment, the prefetch / pre-fill operation between the resource management circuit 104 and the memory 102 uses a set (64) resource identifiers (Buf-IDs) as the basic processing unit, and the resource identifier allocation / release operation between the resource management circuit 104 and the processor 106 uses a batch (8) resource identifiers (Buf-IDs) as the basic processing unit. Furthermore, the resource management circuit 104 maintains multiple indices: Prefetch_index, Pre-return_index, alloc_index, and free_index, to achieve dynamic management of the resource identifiers (Buf-IDs).

[0013] The indices Prefetch_index and Pre-return_index are used to indicate the usage status of resource identifiers Buf-ID in memory 102 in units of 64. Therefore, whenever memory 102 provides a set (64) of resource identifiers Buf-ID to memory 108, the index Prefetch_index will be incremented by 1 (that is, Prefetch_index = Prefetch_index + 1). Similarly, whenever memory 108 returns a set (64) of resource identifiers Buf-ID to memory 102, the index Pre-return_index will be incremented by 1 (that is, Pre-return_index = Pre-return_index + 1). During initialization, the resource management circuit 104 preloads the 16 sets of resource identification codes Buf-IDs (e.g., resource identification codes Buf-IDs from group 0 to group 15) from memory 102 into 16 storage blocks 114_1 to 114_N (N=16) in memory 108. Therefore, the initial value of the index Prefetch_index is 16 (i.e., Prefetch_index=16), which means that the next prefetch operation will read the 16th set of resource identification codes Buf-IDs from memory 102. In addition, since no pre-return operation is triggered during the initial initialization, the initial value of the index Pre-return_index is 0 (i.e., Pre-return_index=0), which means that the first pre-return operation will overwrite the 0th set of resource identification codes Buf-IDs in memory 102.

[0014] The indices alloc_index and free_index are used to represent the usage status of resource identifiers Buf-ID in memory 108, which are in batches (8 units). Since no resource identifier allocation or release operations are triggered during initialization, the initial value of alloc_index will be 0 (i.e., alloc_index=0). This means that the first resource identifier allocation operation will read the resource identifier Buf-ID of the 0th batch in memory 108. Similarly, the initial value of free_index will be 0 (i.e., free_index=0). This means that the first resource identifier release operation will overwrite the resource identifier Buf-ID of the 0th batch in memory 108. In addition, during the subsequent resource identification code management process, whenever memory 102 provides a set (64) resource identification codes Buf-ID to memory 108, the index free_index will be incremented by 8 (that is, free_index = free_index + 8); whenever memory 108 returns a set (64) resource identification codes Buf-ID to memory 102, the index alloc_index will be incremented by 8 (that is, alloc_index = alloc_index + 8); whenever memory 108 provides a batch (8) resource identification codes Buf-ID to memory 110, the index alloc_index will be incremented by 1 (that is, alloc_index = alloc_index + 1); and whenever memory 110 returns a batch (8) resource identification codes Buf-ID to memory 108, the index free_index will be incremented by 1 (that is, free_index = free_index + 1).

[0015] Figure 2 is a flowchart illustrating the operation of resource management circuit 104 processing a resource identification code request from processor 106. If a substantially similar result can be obtained, the steps do not necessarily need to be executed in the exact order shown in Figure 2. When processor (e.g., network processor) 106 forwards network packets, it needs to request a resource identification code Buf-ID (which corresponds to a storage block in the packet buffer used to temporarily store the network packet to be forwarded) from resource management circuit 104 for the network packet to be forwarded. In step S202, resource management circuit 104 receives the resource identification code request from processor 106. In step S204, resource management circuit 104 first determines whether there is an allocatable resource identification code Buf-ID in memory (e.g., SRAM) 108. For example, resource management circuit 104 checks whether the indices alloc_index and free_index meet the following conditions.

[0016] (alloc_index+1)%128 != free_index (1)

[0017] In this embodiment, each storage block in storage blocks 114_1~114_N stores 8 batches of resource identification codes Buf-ID, and the number of storage blocks 114_1~114_N is 16 (that is, N=16). Since the storage blocks 114_1~114_N are used in a manner similar to a ring buffer, both the index alloc_index and free_index will increase from the minimum value of 0 to the maximum value of 127 (that is, 127 = 8*16-1), and then return to the minimum value of 0. Therefore, condition (1) is to determine whether the index alloc_index is about to catch up with the index free_index. If (alloc_index+1)%128 = free_index, this means that all resource identifiers Buf-ID stored in memory 108 have been allocated, and there are no resource identifiers Buf-ID available in memory 108. This means that there are no spare resource identifiers available in memory 102 (detailed in steps S210 and S212). Since processor 106 has exhausted all resource identifiers Buf-ID (which also means that all resource identifiers Buf-ID in memory 102 have also been exhausted), the process will execute step S206 to return the allocation failure information (e.g., 0xffff) to processor 106. On the other hand, if (alloc_index+1)%128 != free_index, it means that there are still resource identifiers Buf-ID in memory 108 that have not been allocated. Therefore, the process will execute step S208 to return a batch (8) of resource identifiers Buf-ID to processor 106 and update the index alloc_index accordingly (that is, alloc_index = alloc_index+1).

[0018] The resource management circuit 104 then checks whether a prefetch operation is needed to replenish new resource identifiers Buf-IDs to memory 108. In this embodiment, the resource management circuit 104 determines whether the number of allocatable resource identifiers Buf-IDs stored in memory 108 is lower than a predetermined threshold TH1 (e.g., TH1 = 12%) and / or whether there are allocatable resource identifiers Buf-IDs in memory 102. Specifically, the prefetch operation is only performed when the number of allocatable resource identifiers Buf-IDs stored in memory 108 is lower than the predetermined threshold TH1 (e.g., TH1 = 12%) and there are allocatable resource identifiers Buf-IDs in memory 102. Note that the order of steps S210 and S212 is interchangeable.

[0019] As mentioned earlier, the storage blocks 114_1~114_N are used in a manner similar to a circular buffer. Therefore, the index alloc_index will start from the minimum value of 0 and increase to the maximum value of 127 (that is, 127 = 8*16-1), and then return to the minimum value of 0. Similarly, the index free_index will also start from the minimum value of 0 and increase to the maximum value of 127 (that is, 127 = 8*16-1), and then return to the minimum value of 0. Basically, the index `free_index` will catch up with the index `alloc_index`, therefore, `free_index` will be less than `alloc_index`. However, when `alloc_index` reaches its maximum value of 127 and returns to its minimum value of 0, `alloc_index` will be less than `free_index`. Therefore, there are two cases between `free_index` and `alloc_index`: Case 1 (alloc_index > free_index) and Case 2 (free_index > alloc_index). Therefore, determining whether the number of allocatable resource identifiers (Buf-IDs) stored in memory 108 is lower than a predetermined threshold TH1 (e.g., TH1 = 12%) can be represented by the following pseudo code:

[0020] if (alloc_index > free_index) / / Case1

[0021] [(128 - alloc_index+free_index) / 128]*10 <= 1.2;

[0022] else / / Case2

[0023] [(free_index-alloc_index) / 128] *10 <= 1.2

[0024] In addition, the resource management circuit 104 checks whether the indices Prefetch_index and Pre-return_index meet the following conditions to determine whether there is an allocatable resource identifier Buf-ID in memory 102.

[0025] (Prefetch_index +1) % 512 != Pre-return_index (2)

[0026] In this embodiment, each storage block in storage blocks 112_1~112_M stores one set (64) of resource identification codes Buf-ID, and the number of storage blocks 112_1~112_M is 512 (that is, M=512). Since the storage blocks 112_1~112_M are used in a manner similar to a ring buffer, both the index Prefetch_index and the Pre-return_index will increase from the minimum value of 0 to the maximum value of 511, and then return to the minimum value of 0. Therefore, condition (2) is to determine whether the index Prefetch_index is about to catch up with the index Pre-return_index. If (Prefetch_index + 1) % 512 = Pre-return_index, this means that all the resource identification codes Buf-ID stored in memory 102 have now been provided to the resource management circuit 104 through the prefetch operation. On the other hand, if (Prefetch_index + 1)%512 != Pre-return_index, this means that the memory 102 still has the resource identification code Buf-ID that has not yet been provided to the resource management circuit 104 through the prefetch operation.

[0027] When the number of allocable resource identifiers Buf-ID stored in memory 108 is higher than a predetermined threshold TH1 (e.g., TH1 = 12%) or memory 102 does not have any allocable resource identifiers Buf-ID, the resource management circuit 104 does not need to perform a prefetch operation (step S216). On the other hand, when the number of allocable resource identifiers Buf-ID stored in memory 108 is lower than the predetermined threshold TH1 (e.g., TH1 = 12%) and memory 102 has allocable resource identifiers Buf-ID, the process proceeds to step S214. In step S214, the resource management circuit 104 prefetches a set (64) of resource identification codes Buf-ID from the location pointed to by Prefetch_index in memory (e.g., DRAM) 102 and writes them to the location pointed to by free_index in memory (e.g., SRAM) 108. In addition, the resource management circuit 104 updates the index Prefetch_index (e.g., Prefetch_index = Prefetch_index + 1) and the index free_index (e.g., free_index = free_index + 8).

[0028] Figure 3 is a schematic diagram of the resource management circuit 104 performing a prefetch operation in Case 1 according to an embodiment of the present invention. Figure 4 is a schematic diagram of the resource management circuit 104 performing a prefetch operation in Case 2 according to an embodiment of the present invention. Assume that memory 102 currently has an allocable resource identifier Buf-ID. As shown in Figure 3, after the resource management circuit 104 returns a batch (8) resource identification codes Buf-ID to the processor 106 in response to the request from the processor 106, the index alloc_index will be updated from 124 to 125 (that is, 125 = (124 + 1) % 128). At this time, alloc_index = 125 > free_index = 12. Since the prefetch operation trigger condition is met (Case 1: [(128 – 125 + 12) / 128] * 10 = 1.17 <= 1.2), the resource management circuit 104 will read a set (64) of resource identification codes Buf-ID from memory 102 and write it to memory 108. At this time, the index free_index will be updated from 12 to 20 (that is, 20 = (12 + 8) % 128). Although not illustrated, it can be seen from the above that the prefetch_index of memory 102 will increase by 1 at this time. As shown in Figure 4, after the resource management circuit 104 returns a batch (8) resource identification codes Buf-ID to the processor 106 in response to the request from the processor 106, the index alloc_index will be updated from 108 to 109 (that is, 109 = (108 + 1) % 128). At this time, free_index = 124 > alloc_index = 109. Since the prefetch operation trigger condition is met (Case 2: [(124 - 109) / 128] * 10 = 1.17 <= 1.2), the resource management circuit 104 will read a set (64) of resource identification codes Buf-ID from memory 102 and write it to memory 108. At this time, the index free_index will be updated from 124 to 4 (that is, 4 = (124 + 8) % 128). Although not illustrated, it can be seen from the above that the prefetch_index of memory 102 will increase by 1 at this time.

[0029] Figure 5 is a flowchart of the operation of resource management circuit 104 processing resource identification code release requests from processor 106. If a substantially similar result can be obtained, the steps do not necessarily need to be executed in the exact order shown in Figure 5. Processor (e.g., network processor) 106 initiates network packet transmission (Tx) for network packet forwarding. Upon receiving the instruction "Tx_done" (transmission complete, starting to release occupied resources), the corresponding resource identification code (Buf-ID) can be released for use by subsequent network packets. Therefore, processor (e.g., network processor) 106 needs to release the resource identification code (Buf-ID) occupied by the forwarded network packets (which corresponds to the storage block in the packet buffer) through resource management circuit 104. In step S502, resource management circuit 104 receives a resource identification code release request from processor 106. In step S504, the resource management circuit 104 first determines whether there is available storage space in the memory (e.g., SRAM) 108. For example, the resource management circuit 104 checks whether the indices alloc_index and free_index meet the following conditions.

[0030] (free_index+1)%128 != alloc_index (3)

[0031] In this embodiment, each storage block in storage blocks 114_1~114_N stores 8 batches of resource identification codes Buf-ID, and the number of storage blocks 114_1~114_N is 16 (that is, N=16). Since the storage blocks 114_1~114_N are used in a manner similar to a ring buffer, both the index free_index and alloc_index will increase from the minimum value of 0 to the maximum value of 127 (that is, 127 = 8*16-1), and then return to the minimum value of 0. Therefore, condition (3) is to determine whether the index free_index is about to catch up with the index alloc_index. If (free_index+1)%128 = alloc_index, this means that there are no more empty slots for resource identifiers Buf-ID in memory 108 that can be overwritten, and therefore no more resource identifiers Buf-ID can be written. This also means that there are no empty slots for resource identifiers available in memory 102 (detailed in steps S510 and S512). Therefore, the process will execute step S506 to return a release failure message to processor 106. On the other hand, if (free_index+1)%128 != alloc_index, this means that there are still resource identifiers Buf-ID that can be overwritten in memory 108. Therefore, the process will execute step S508 to write a batch (8) of resource identifiers Buf-ID from the internal memory 110 of processor 106 to memory 108 to release these resource identifiers Buf-ID occupied by forwarded network packets. In addition, the index free_index will be updated at the same time (that is, free_index = free_index+1).

[0032] The resource management circuit 104 then checks whether a pre-filling operation is needed to fill back a portion of the allocatable resource identifiers Buf-ID in memory 108 to memory 102. In this embodiment, the resource management circuit 104 determines whether the number of allocatable resource identifiers Buf-ID stored in memory 108 is higher than a predetermined threshold TH2 (e.g., TH2 = 88%) and / or whether there is usable storage space in memory 102. Specifically, the pre-filling operation is only performed when the number of allocatable resource identifiers Buf-ID stored in memory 108 is higher than the predetermined threshold TH2 (e.g., TH2 = 88%) and there is usable storage space in memory 102. Note that the order of steps S510 and S512 is interchangeable.

[0033] As mentioned earlier, the storage blocks 114_1~114_N are used in a manner similar to a circular buffer. Therefore, the index alloc_index will start from the minimum value of 0 and increase to the maximum value of 127 (that is, 127 = 8*16-1), and then return to the minimum value of 0. Similarly, the index free_index will start from the minimum value of 0 and increase to the maximum value of 127 (that is, 127 = 8*16-1), and then return to the minimum value of 0. Basically, the index `alloc_index` precedes the index `free_index`, therefore, the index `free_index` will be less than the index `alloc_index`. However, after the index `alloc_index` reaches its maximum value of 127 and returns to its minimum value of 0, the index `alloc_index` will actually be less than the index `free_index`. Therefore, there are two cases between the indexes `free_index` and `alloc_index`: Case 1 (alloc_index > free_index) and Case 2 (free_index > alloc_index). Thus, determining whether the number of allocatable resource identifiers `Buf-ID` stored in memory 108 is higher than a predetermined threshold `TH2` (e.g., `TH2 = 12%) can be represented by the following virtual code:

[0034] if (alloc_index > free_index) / / Case1

[0035] [(128 - alloc_index+free_index) / 128]*10 >= 8.8;

[0036] else / / Case2

[0037] [(free_index-alloc_index) / 128] *10 >= 8.8

[0038] In addition, the resource management circuit 104 checks whether the indices Prefetch_indexm and Pre-return_index meet the following conditions to determine whether there is usable storage space in memory 102.

[0039] (Pre-return_index +1) % 512 != Prefetch_index (4)

[0040] In this embodiment, each storage block in storage blocks 112_1~112_M stores one set (64) of resource identification codes Buf-ID, and the number of storage blocks 112_1~112_M is 512 (that is, M=512). Since the storage blocks 112_1~112_M are used in a manner similar to a ring buffer, both the index Prefetch_index and Pre-return_index will increase from the minimum value of 0 to the maximum value of 511, and then return to the minimum value of 0. Therefore, condition (4) is to determine whether the index Pre-return_index is about to catch up with the index Prefetch_index. If (Pre-return_index+1)%512 = Prefetch_index, this means that there are no more resource identification codes Buf-IDs in memory 102 that can be overwritten. On the other hand, if (Pre-return_index+1) % 512 != Prefetch_index, this means that memory 102 still has a rewritable resource identifier Buf-ID.

[0041] When the number of allocable resource identifiers Buf-ID stored in memory 108 is lower than a predetermined threshold TH2 (e.g., TH2 = 88%) or there is no usable storage space in memory 102, the resource management circuit 104 does not need to perform a pre-filling operation (step S516). On the other hand, when the number of allocable resource identifiers Buf-ID stored in memory 108 is higher than a predetermined threshold TH2 (e.g., TH1 = 12%) and there is usable storage space in memory 102, the process proceeds to step S514. In step S514, the resource management circuit 104 retrieves a set (64) of resource identification codes Buf-ID from the location pointed to by alloc_index in memory 108 (e.g., SRAM) and writes them to the location pointed to by Pre-return_index in memory (e.g., DRAM). In addition, the resource management circuit 104 updates the index Pre-return_index (e.g., Pre-return_index = Pre-return_index + 1) and the index alloc_index (e.g., alloc_index = alloc_index + 8).

[0042] Figure 6 is a schematic diagram of the resource management circuit 104 performing a pre-fill operation in Case 1 according to an embodiment of the present invention. Figure 7 is a schematic diagram of the resource management circuit 104 performing a pre-fill operation in Case 2 according to an embodiment of the present invention. Assume that memory 102 currently has available storage space. As shown in Figure 6, after the resource management circuit 104 writes a batch (8) of resource identification codes Buf-ID in response to the release request of the processor 106, the index free_index will be updated from 108 to 109 (that is, 109 = (108 + 1) % 128). At this time, alloc_index = 124 > free_index = 109. Since the triggering condition of the pre-return operation is met (Case 1: [(128 – 124 + 109) / 128] * 10 = 8.82 >= 8.8), the resource management circuit 104 will read a set (64) of resource identification codes Buf-ID from memory 108 and write it to memory 102. At this time, the index alloc_index will be updated from 124 to 4 (that is, 4 = (124 + 8) % 128). Although not illustrated, it can be seen from the above that the pre-return_index of memory 102 will increase by 1 at this time. As shown in Figure 7, after the resource management circuit 104 writes a batch (8) of resource identification codes Buf-ID in response to the release request of the processor 106, the index free_index will be updated from 124 to 125 (that is, 125 = (124 + 1) % 128). At this time, free_index = 125 > alloc_index = 12. Since the triggering condition of the pre-return operation is met (Case 2: [(125 - 12) / 128] * 10 = 8.82 >= 8.8), the resource management circuit 104 will read a set (64) of resource identification codes Buf-ID from memory 108 and write it to memory 102. At this time, the index alloc_index will be updated from 12 to 20 (that is, 20 = (12 + 8) % 128). Although not illustrated, it can be seen from the above that the pre-return_index of memory 102 will increase by 1 at this time.

[0043] In summary, this invention employs a multi-layer architecture to manage resource identification codes. The memory (e.g., DRAM) 102 has a large storage capacity, thus it can store all resource identification codes (Buf-IDs), for example, 10K to 100K resource identification codes (Buf-IDs), occupying 20 to 200KB of space. The memory (e.g., SRAM) 108 serves as a buffer, storing only a portion of the resource identification codes (Buf-IDs), for example, 1K resource identification codes (Buf-IDs), occupying 2KB of space. Furthermore, the internal memory (e.g., SRAM) 110 serves as the cache memory for the processor 106, storing a smaller number of resource identification codes (Buf-IDs), for example, 8 resource identification codes (Buf-IDs), occupying 16B of space.

[0044] For memory (e.g., SRAM) 108, only one read and one write operation is required every 8 network packets. For memory (e.g., DRAM) 102, in the worst case, one read and one write operation is required every 64 network packets. However, in most cases, frequent read and write operations on memory (e.g., DRAM) 102 are unnecessary. This is mainly because processor 106 can release resource identification codes Buf-ID back to memory (e.g., SRAM) 108 of resource management circuit 104, so that these released resource identification codes Buf-ID can be reassigned by resource management circuit 104. Therefore, the resource identification codes Buf-ID stored in memory (e.g., SRAM) 108 can be regarded as hot spot IDs that can be reused continuously. As long as the trigger threshold of prefetch operation or prefill operation is not reached, there is no need to access memory (e.g., DRAM) 102. When the network packet rate is stable, the processor 106 will reach a balance in the allocation and release of resource identifiers (Buf-IDs), and the number of occupied resource identifiers (Buf-IDs) will not fluctuate much. There will be no frequent exchange of resource identifiers between memory (e.g., DRAM) 102 and memory (e.g., SRAM) 108. On the other hand, when the network packet rate increases, decreases, or becomes unstable, the number of occupied resource identifiers (Buf-IDs) may fluctuate significantly. At this time, it is necessary to exchange resource identifiers between memory (e.g., DRAM) 102 and memory (e.g., SRAM) 108. The above description is only a preferred embodiment of the present invention. All equivalent changes and modifications made in accordance with the claims of the present invention shall be covered by the present invention.

[0045] 100: Resource Management Device 102, 108: Memory 104: Resource Management Circuit 106: Processor 110: Internal Memory 112_1,112_2,112_M,114_1,114_2,114_N,116_1,116_2,116_R: Storage blocks Prefetch_index, Pre-return_index, alloc_index, free_index: index Tx: Send Tx_done: Sending completed S202, S204, S206, S208, S210, S212, S214, S216, S502, S504, S506, S508, S510, S512, S514, S516: Steps

Claims

1. A resource management device, comprising: a processor having an internal memory; a resource management circuit having a first memory; and a second memory, wherein the access speed of the first memory is higher than the access speed of the second memory; wherein the resource management circuit is configured to load a plurality of first resource identifiers stored in the second memory into the first memory, and return a plurality of second resource identifiers stored in the first memory to the second memory; the resource management circuit is further configured to load a plurality of third resource identifiers stored in the first memory into the internal memory, and return a plurality of fourth resource identifiers stored in the internal memory to the first memory; the resource management circuit is further configured to receive a resource identifier request issued by the processor; and in response to the resource identifier request, the resource management circuit loads the plurality of third resource identifiers into the internal memory.

2. The resource management device as described in claim 1, wherein in response to the resource identification code application request, the resource management circuit is further configured to determine whether there is an allocatable resource identification code in the first memory, and when it is determined that there is an allocatable resource identification code in the first memory, loads the plurality of third resource identification codes into the internal memory.

3. The resource management device as described in claim 1, wherein after the plurality of third resource identifiers are loaded into the internal memory, the resource management circuit is further configured to determine whether the number of allocatable resource identifiers stored in the first memory is lower than a predetermined threshold and whether the second memory has allocatable resource identifiers; and when it is determined that the number of allocatable resource identifiers stored in the first memory is lower than the predetermined threshold and the second memory has allocatable resource identifiers, the resource management circuit loads the plurality of first resource identifiers into the first memory.

4. A resource management device, comprising: a processor having an internal memory; a resource management circuit having a first memory; and a second memory, wherein the access speed of the first memory is higher than the access speed of the second memory; wherein the resource management circuit is configured to load a plurality of first resource identifiers stored in the second memory into the first memory, and return a plurality of second resource identifiers stored in the first memory to the second memory; the resource management circuit is further configured to load a plurality of third resource identifiers stored in the first memory into the internal memory, and return a plurality of fourth resource identifiers stored in the internal memory to the first memory; the resource management circuit is further configured to receive a resource identifier release request issued by the processor; and in response to the resource identifier release request, the resource management circuit returns the plurality of fourth resource identifiers to the first memory.

5. The resource management device as described in claim 4, wherein in response to the resource identification code release request, the resource management circuit is further configured to determine whether there is available storage space in the first memory, and when it is determined that there is available storage space in the first memory, returns the plurality of fourth resource identification codes to the first memory.

6. The resource management device as described in claim 4, wherein after the plurality of fourth resource identification codes are returned to the first memory, the resource management circuit is further configured to determine whether the number of allocatable resource identification codes stored in the first memory is higher than a predetermined threshold and whether there is usable storage space in the second memory; and when it is determined that the number of allocatable resource identification codes stored in the first memory is higher than the predetermined threshold and there is usable storage space in the second memory, the resource management circuit returns the plurality of second resource identification codes to the second memory.

7. The resource management device as described in claim 4, wherein the processor is a network processor.

8. The resource management device as described in claim 4, wherein the internal memory and the first memory are both static random access memory, and the second memory is dynamic random access memory.

9. A resource management device, comprising: a processor having an internal memory; a resource management circuit having a first memory; and a second memory, wherein the access speed of the first memory is higher than the access speed of the second memory; wherein the resource management circuit is configured to load a plurality of first resource identifiers stored in the second memory into the first memory, and return a plurality of second resource identifiers stored in the first memory to the second memory; the resource management circuit is further configured to load a plurality of third resource identifiers stored in the first memory into the internal memory, and return a plurality of fourth resource identifiers stored in the internal memory to the first memory; and each resource identifier corresponds to a storage block in a packet buffer for temporarily storing a network packet.

10. A resource management method, comprising: loading a plurality of first resource identifiers stored in a second memory into a first memory, wherein the access speed of the first memory is higher than the access speed of the second memory; returning the plurality of second resource identifiers stored in the first memory to the second memory; loading a plurality of third resource identifiers stored in the first memory into an internal memory of a processor; returning a plurality of fourth resource identifiers stored in the internal memory to the first memory; and receiving a resource identifier request issued by the processor; wherein the step of loading the plurality of third resource identifiers stored in the first memory into the internal memory of the processor comprises: loading the plurality of third resource identifiers into the internal memory in response to the resource identifier request.

11. The resource management method as described in claim 10, wherein the step of loading the plurality of third resource identifiers into the internal memory in response to the resource identifier application request comprises: determining whether the first memory has an allocatable resource identifier; and loading the plurality of third resource identifiers into the internal memory when the first memory has an allocatable resource identifier.

12. The resource management method as described in claim 10, wherein the step of loading the plurality of first resource identifiers stored in the second memory into the first memory comprises: after the plurality of third resource identifiers are loaded into the internal memory, determining whether the number of allocatable resource identifiers stored in the first memory is lower than a predetermined threshold and whether the second memory has allocatable resource identifiers; and because the number of allocatable resource identifiers stored in the first memory is lower than the predetermined threshold and the second memory has allocatable resource identifiers, loading the plurality of first resource identifiers into the first memory.

13. A resource management method, comprising: loading a plurality of first resource identifiers stored in a second memory into a first memory, wherein the access speed of the first memory is higher than the access speed of the second memory; returning the plurality of second resource identifiers stored in the first memory to the second memory; loading a plurality of third resource identifiers stored in the first memory into an internal memory of a processor; returning a plurality of fourth resource identifiers stored in the internal memory to the first memory; and receiving a resource identifier release request issued by the processor; wherein the step of returning the plurality of fourth resource identifiers stored in the internal memory to the first memory comprises: returning the plurality of fourth resource identifiers to the first memory in response to the resource identifier release request.

14. The resource management method as described in claim 13, wherein the step of returning the plurality of fourth resource identifiers to the first memory in response to the resource identifier release request comprises: determining whether there is available storage space in the first memory; and returning the plurality of fourth resource identifiers to the first memory in response to the availability of storage space in the first memory.

15. The resource management method as described in claim 13, wherein the step of returning the plurality of second resource identifiers stored in the first memory to the second memory comprises: after the plurality of fourth resource identifiers are returned to the first memory, determining whether the number of allocatable resource identifiers stored in the first memory is higher than a predetermined threshold and whether there is usable storage space in the second memory; and because the number of allocatable resource identifiers stored in the first memory is higher than the predetermined threshold and there is usable storage space in the second memory, returning the plurality of second resource identifiers to the second memory.

16. The resource management method as described in claim 13, wherein the processor is a network processor.

17. The resource management method as described in claim 13, wherein the internal memory and the first memory are both static random access memory, and the second memory is dynamic random access memory.

18. A resource management method, comprising: loading a plurality of first resource identifiers stored in a second memory into a first memory, wherein the access speed of the first memory is higher than the access speed of the second memory; returning a plurality of second resource identifiers stored in the first memory to the second memory; loading a plurality of third resource identifiers stored in the first memory into an internal memory of a processor; and returning a plurality of fourth resource identifiers stored in the internal memory to the first memory; wherein each resource identifier corresponds to a storage block in a packet buffer for temporarily storing a network packet.

Citation Information

Patent Citations

  • Resource management method, device and equipment

    CN111427870A

  • Information processing system, information processing method, and computer program used therewith

    TW200627181A

  • Electronic device and device resource management method thereof

    TW202439136A

  • Resource management

    US20240323145A1