Allocate shared reserved memory to queues in network devices
By introducing a combination of shared buffers, private reserved memory, and shared reserved memory pools into network devices, the problem of uneven allocation of memory resources is solved, achieving efficient and fair allocation of memory resources and improving the performance and stability of network devices.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- MELLANOX TECHNOLOGIES LTD(IL)
- Filing Date
- 2023-01-16
- Publication Date
- 2026-05-26
AI Technical Summary
In existing network devices, the memory resource allocation scheme is difficult to efficiently and flexibly meet the memory needs of each queue when facing changes in traffic load. This results in low-activity queues lacking memory resources due to the influence of high-activity queues, which may lead to congestion or packet dropping.
A combination of shared buffers, private reserved memory, and shared reserved memory pools is adopted. Memory resources are adaptively allocated through memory management circuitry to ensure that low-activity queues can obtain additional memory when high-activity queues have demand, thus avoiding congestion.
It enables efficient and fair allocation of memory resources in network devices, ensuring that each queue can respond promptly to traffic changes, avoiding congestion and packet drop, and improving the throughput and stability of network devices.
Smart Images

Figure CN116527766B_ABST
Abstract
Description
[0001] This disclosure of the field
[0002] This invention generally relates to network communication, and more particularly to the management of memory resources in network devices. Background Technology
[0003] Some network devices, such as packet switches, use shared memory schemes to efficiently store packets and other data. For example, U.S. Patent 10,250,530 describes a technique for flexible buffer allocation in a network switch. This patent describes a communication apparatus comprising multiple interfaces configured to connect to a packet data network for receiving and forwarding various types of data packets. A memory is coupled to the interfaces and configured as a buffer to hold packets received through an ingress interface while awaiting transmission to the network through an egress interface. Packet processing logic is configured to maintain multiple transmit queues associated with corresponding egress interfaces, placing first and second queue entries corresponding to first and second data packets of first and second types, respectively, in a common transmit queue for transmission through a given egress interface, while allocating appropriate space in buffers for independent first and second buffer allocations, respectively, to store the first and second data packets assigned to the first and second types. Summary of the Invention
[0004] The embodiments of the present invention described herein provide a network device including one or more ports, a packet processor, and memory management circuitry. One or more ports are used to transmit packets over the network. The packet processor is used to process packets using multiple queues. The memory management circuitry is used to maintain a shared buffer in memory and adaptively allocate memory resources from the shared buffer to queues. In addition to the shared buffer, it is also used to maintain a shared-reserve memory pool in memory for use by a defined subset of queues, to identify queues within the subset that (i) require additional memory resources, (ii) are not eligible for additional allocation from the shared buffer, and (iii) meet the eligibility criteria for the shared-reserve memory pool, and to allocate memory resources from the shared-reserve memory pool to the identified queues.
[0005] In some embodiments, the memory management circuitry is configured to determine that a queue requires additional memory resources by receiving requests from the queue. In some embodiments, the memory management circuitry is configured to identify that a queue is not eligible for additional allocation from the shared buffer by recognizing that its occupancy exceeds a MAX threshold set for the queue. In an example embodiment, the memory management circuitry is configured to verify that the queue's occupancy meets the eligibility criteria for the shared reserved memory pool by verifying that the occupancy does not exceed a defined margin above the MAX threshold.
[0006] In the disclosed embodiments, the memory management circuitry is used to pre-allocate private-reserve memory resources to queues, regardless of shared buffers and shared-reserve memory pools. In these embodiments, the queues in the subset are associated with the same port of the network device.
[0007] According to the embodiments described herein, a memory management circuitry in a network device is also provided. This memory management circuitry includes one or more interfaces and circuitry. The one or more interfaces are used to communicate with multiple queues of the network device that process packets and with the memory. The circuitry is used to maintain a shared buffer in the memory and adaptively allocate memory resources from the shared buffer to the queues. In addition to the shared buffer, it is also used to maintain a shared reserved memory pool in the memory for use by a defined subset of queues, to identify queues in the subset that (i) require additional memory resources, (ii) are not eligible for additional allocation from the shared buffer, and (iii) meet the eligibility criteria for the shared reserved memory pool, and to allocate memory resources from the shared reserved memory pool to the identified queues.
[0008] According to the embodiments described herein, a method for communicating in a network device is also provided. The method includes: transmitting packets over a network and using multiple queues to process the packets. A shared buffer is maintained in memory, and memory resources are adaptively allocated from the shared buffer to the queues. In addition to the shared buffer, a shared reserved memory pool is also maintained in memory for use by a subset of queue definitions. Queues are identified in the subset that (i) require additional memory resources, (ii) are not eligible for additional allocation from the shared buffer, and (iii) meet the eligibility criteria for the shared reserved memory pool. Memory resources are allocated from the shared reserved memory pool to the identified queues.
[0009] According to the embodiments described herein, a method for memory management in a network device is further provided. The method includes communicating with multiple queues of the network device that process packets and communicating with memory. A shared buffer is maintained in memory, and memory resources are adaptively allocated from the shared buffer to the queues. In addition to the shared buffer, a shared reserved memory pool is also maintained in memory for use by a subset of queues as defined. Queues are identified in the subset that (i) require additional memory resources, (ii) are not eligible for additional allocation from the shared buffer, and (iii) meet the eligibility criteria for the shared reserved memory pool. Memory resources are allocated from the shared reserved memory pool to the identified queues.
[0010] According to the embodiments described herein, a method for memory management in a network device that processes packets using queues is also provided. The method includes maintaining (i) a shared buffer and (ii) a shared reserved memory pool in memory. Queues are identified that (i) require additional memory resources, (ii) are not eligible for additional allocation from the shared buffer, and (iii) are eligible for allocation from the shared reserved memory pool. Memory resources are allocated from the shared reserved memory pool to the identified queues.
[0011] The present invention will be more fully understood from the following detailed description of its embodiments taken in conjunction with the accompanying drawings. Attached Figure Description
[0012] Figure 1 This is a schematic block diagram illustrating a network device according to an embodiment of the present invention, the network device including a shared buffer, a private reserve memory, and a shared reserve memory pool;
[0013] Figure 2 The illustration of an embodiment of the invention is shown schematically for use in Figure 1 A diagram illustrating the threshold and range of memory resource occupancy for allocating memory resources to queues in network devices; and
[0014] Figure 3 This is an illustrative description of an embodiment of the present invention. Figure 1 The flowchart shows the method for allocating memory resources to a queue in a network device. Detailed Implementation
[0015] Overview
[0016] The embodiments of the present invention described herein provide improved methods and apparatus for allocating memory resources to queues in network devices (e.g., packet switches).
[0017] In some embodiments, a network device includes one or more ports for sending and receiving packets over the network, and a packet processor for processing packets. As part of packet processing, the packet processor queues packets in multiple queues. In a typical implementation, a given port is assigned a separate receive queue and a send queue. Packets in a given direction (receive or send) are queued in separate queues according to their priority groups. Typically, packet data is stored in memory, while the queues store descriptors or pointers to that data.
[0018] In real-world network devices, traffic loads can vary significantly from port to port and / or over time. Therefore, queue memory requirements are typically highly variable. Since the overall memory resources of a network device are limited, memory allocation to queues must be fast, flexible, and efficient to maintain high throughput and avoid congestion. In some embodiments of the invention, the network device includes a memory management circuit (MMC) that manages the network device's memory resources, including allocating appropriate memory resources to each queue.
[0019] In some embodiments, the MMC maintains three different types of memory regions in memory, referred to as a shared buffer, private reserved memory, and a shared reserved memory pool. The MMC allocates the memory resources of these three regions to queues in accordance with the standards described herein.
[0020] Privately reserved memory resources are typically allocated a priori to queues and remain allocated to the same queues regardless of actual queue occupancy. This a priori static allocation allows queues to respond immediately to rapidly evolving traffic bursts.
[0021] The shared buffer's memory resources are typically allocated adaptively to queues based on their occupancy rates. Generally, highly active and full queues will receive more memory from the shared buffer, while idle queues will receive little or no allocation. Queues usually begin requesting allocation from the shared buffer once their pre-allocated private reserve allocation is exhausted. This shared buffer allocation mechanism maintains fairness among active queues.
[0022] In some embodiments, the MMC defines a maximum occupancy rate (referred to herein as a "MAX-STATE" threshold) exceeding which queues are disqualified from receiving additional allocations from the shared buffer. The MAX-STATE threshold is adaptive and depends on the overall demand for the shared buffer resource. When the overall demand for the shared buffer resource is high, for example, when some queues experience congestion, the MMC will decrease the MAX-STATE threshold. When the overall demand for the shared buffer resource is low, the MMC will increase the MAX-STATE threshold. This mechanism introduces a degree of fairness among queues when competing for the shared buffer resource.
[0023] In practice, the allocation scheme described above may encounter problems in certain scenarios. For example, consider a situation where one queue has a relatively low activity level and low occupancy, while other queues are highly active and full. Using the allocation scheme described above, the large and busy queues will receive a large number of allocations from the shared buffer, causing the MMC to drop the MAX-STATE threshold. As a result, the low-activity queue may become ineligible for shared buffer allocations. In this case, the low-activity queue may not be able to handle bursts of packets well; for example, it may become congested or drop packets.
[0024] This example illustrates that low-activity queues can be affected by the fact that high-activity queues dominate shared buffer allocations. This scenario is particularly problematic because low-activity queues often also receive a small amount of privately reserved allocations at the start.
[0025] In some embodiments, the MMC utilizes the resources of a shared reserved memory pool, avoiding the aforementioned situation and other potentially problematic scenarios. In these embodiments, the MMC defines an additional occupancy level range above the MAX-STATE threshold, where queues are eligible for allocation from the shared reserved memory pool. In an embodiment, the MMC identifies queues that need additional memory but are too full to be allocated from the shared buffer (i.e., queues whose occupancy exceeds the MAX-STATE threshold). If the queue's occupancy level is not so high as to exceed the MAX-STATE threshold (e.g., up to a predetermined margin exceeding the MAX-STATE threshold), the MMC allocates additional memory for that queue from the shared reserved memory pool. Therefore, the shared reservation mechanism ensures that small and relatively idle queues do not lack memory resources due to high demand from other queues.
[0026] In some embodiments, the MMC maintains multiple separate shared reserved memory pools for multiple respective subsets of queues. For example, the MMC can maintain a shared reserved memory pool for queues on each port.
[0027] This article describes several example implementations of the memory allocation scheme disclosed herein.
[0028] System Description
[0029] Figure 1 This is a block diagram illustrating a network device 20 according to an embodiment of the present invention. Network device 20 may include, for example, a switch, router, network adapter such as a network interface controller (NIC), or any other suitable packet-processing network device. The following description will primarily relate to a packet switch, for example.
[0030] Network device 20 includes one or more ports 24 for receiving packets from packet network 28 and / or transmitting packets to network 28. Switches or routers typically include multiple ports 24. Network adapters may include a single port 24 or multiple ports 24. Network 28 and network device 20 can operate according to any suitable network communication protocol, such as Ethernet, InfiniBand, etc. TM Or Nvidia forwarding protocol (“NVL”).
[0031] Network device 20 further includes packet processor 32, which processes packets received and transmitted through port 24. For example, in a switch, packet processor 32 forwards each incoming packet to the appropriate port for transmission.
[0032] As part of packet processing, packet processor 32 queues packets in multiple queues 36. In practice, queues 36 typically do not store actual packet data, but rather descriptors, pointers, or other metadata pointing to packets. For clarity, this queuing is also referred to herein as "queuing packets." In the example embodiment, for a given port 24, separate queues are designated for receiving ("incoming") and for transmitting ("outgoing"). For a given direction (transmit or receive), separate queues are designated for different priority groups being used.
[0033] Network device 20 further includes memory 40, which, among other things, stores packet data including headers and / or payloads. Resources of memory 40 can be allocated to various queues 36 for storing packets. Three separate memory regions are defined within memory 40: a shared buffer 44, a private reserved memory 48, and a shared reserved memory pool 52. In alternative embodiments, at least some regions of memory 40 (e.g., shared buffer 44) may reside outside the network device.
[0034] Memory 40 is managed by a memory management circuit (MMC) 56. In other tasks, the MMC 56 defines a shared buffer 44, a private reserved memory 48, and a shared reserved memory pool 52, and allocates memory resources from various memory regions to queue 36. An example allocation scheme will be described in detail below. The MMC 56 typically includes one or more interfaces for communicating with queue 36 and memory 40, as well as circuitry for performing the memory allocation tasks described herein.
[0035] The network device 20 further includes a controller 60, which performs various control plane and management tasks.
[0036] The configuration of network device 20 and its various components, such as packet processor 32, MMC 56, and memory 40, is an example configuration chosen purely for conceptual clarity. Any other suitable configuration may be used in alternative embodiments. In various embodiments, network device 20 and its various components may be implemented using hardware, such as one or more application-specific integrated circuits (ASICs) and / or field-programmable gate arrays (FPGAs), software, or a combination of hardware and software components. Memory 40 typically includes suitable random access memory (RAM).
[0037] In some embodiments, certain components of the network device 20, such as the controller 60 and possibly the MMC 56, may be implemented using a general-purpose processor programmed in software to implement the functions described herein. This software may be downloaded electronically to the processor via a network or similar means, or alternatively or additionally provided and / or stored on a non-transitory tangible medium, such as magnetic, optical, or electronic memory.
[0038] Memory allocation using shared buffers, private reserved memory, and shared reserved memory
[0039] In some embodiments of the invention, a memory management circuit (MMC) 56 allocates memory resources for each queue 36 from (i) a shared buffer 44, (ii) a private reserved memory 48, and (iii) a shared reserved memory pool 52. Each of these memory regions has its own characteristics. The MMC 53 allocates resources for each region according to different criteria.
[0040] The memory resources of private reserved memory 48 are typically allocated a priori to queue 36 (or at least some queues 36) by MMC 56. Private reserved memory is typically maintained allocated to the same queues regardless of actual queue occupancy. This allocation allows queue 36 to respond immediately to traffic bursts and maintain forward progress, even in congested equipment. The size of the private reserved allocation can vary from one queue to another. For example, a further aspect of using private reserved memory is covered in U.S. Patent Application 17 / 503,383, filed October 18, 2021, entitled "Dynamic Reserve Allocation on Shared-Buffer".
[0041] The memory resources of shared buffer 44 are typically allocated adaptively by MMC 56, depending on the occupancy rate of each queue. Generally, highly active and full queues 36 will allocate more memory from shared buffer 44, while idle queues will receive little or no shared buffer allocation. For example, various aspects of shared buffer allocation are described in the above-cited U.S. Patent 10,250,530. Queues typically begin requesting allocation from shared buffer 44 after exhausting their private reserved allocation (which is pre-allocated from private reserved memory 48).
[0042] In some embodiments, MMC 56 defines a maximum occupancy rate (referred to herein as a “MAX-STATE” threshold) beyond which queue 36 is ineligible to receive additional allocations from shared buffer 44. Without the assistance of the disclosed techniques, queues ineligible to receive additional allocations from the shared buffer may drop packets (in lossy traffic implementations) or overuse flow control (e.g., credit in lossless traffic implementations).
[0043] The MAX-STATE threshold is adaptive and depends on the overall demand for shared buffer resources. When the overall demand for shared buffer resources is high, for example, when some queues become congested, MMC 56 typically lowers the MAX-STATE threshold. When the overall demand for shared buffer resources is low, MMC 56 typically increases the MAX-STATE threshold. This mechanism introduces a degree of fairness among queues when competing for shared buffer resources.
[0044] As mentioned above, the allocation scheme using shared buffers and private reserved memory can cause problems in certain situations. For example, due to the adaptability of the MAX-STATE threshold, low-activity queues may become ineligible for shared buffer allocations when high-activity queues have high memory requirements.
[0045] In some embodiments, MMC 56 uses the resources of shared reserved memory pool 52 to avoid this problematic situation. In these embodiments, MMC 56 defines additional occupancy level ranges above the MAX-STATE threshold, within which queues are eligible for allocation from shared reserved memory pool 52. Various occupancy thresholds and ranges are detailed below. Figure 2 It is described in the text.
[0046] In one embodiment, MMC 56 determines that queue 36 requires additional memory, but that queue is too full to qualify for allocation from shared buffer 44 (i.e., a queue whose occupancy exceeds the MAX-STATE threshold). If the queue's occupancy level is not too high above the MAX-STATE threshold (e.g., reaching a predefined margin above the MAX-STATE threshold), then MMC 52 allocates memory resources to that queue from shared reserved memory pool 52.
[0047] Figure 2 This is a schematic diagram illustrating the occupancy threshold and range for allocating memory resources to queue 36 according to an embodiment of the present invention. The queue in the diagram can be as described above. Figure 1 Any one of the queues 36 in the network device 20.
[0048] The occupancy rate of queue 36 is variable, depending on its fill rate and empty rate. At any given time, queue 36 has a current occupancy level represented by 110. The private reservation allocation assigned to queue 36 is marked by a private reservation threshold of 114. This level is static, meaning it does not change based on the queue's actual occupancy level.
[0049] The current level of the MAX-STATE threshold is represented as 118 in the figure. As mentioned above, the MAX-STATE threshold 118 is varied by the MMC56 based on the overall demand for allocation from the shared buffer 44. When demand is high, the MMC56 reduces the MAX-STATE threshold 118, and vice versa. In a typical implementation, the MMC calculates the MAX-STATE threshold for a given queue based on (i) the total available memory space remaining in the shared buffer and (ii) the number of queues assigned to the shared buffer pool. Therefore, as the available memory space in the shared buffer decreases, the potential additional memory available for allocation to a given queue also decreases.
[0050] When the occupancy level 110 of queue 36 is between the private reservation threshold 114 and the MAX-STATE threshold 118, queue 36 is eligible to receive additional allocations from shared buffer 44. (When the occupancy level 110 is below this range, the queue still has available resources from its private reservation allocations. When the occupancy level 110 is above this range, the shared buffer management scheme will prevent the allocation of additional memory from the shared buffer to the queue.)
[0051] A predefined margin of 122 is set by MMC 56 as the upper limit for eligibility to allocate from the shared reserved memory pool 52. In other words, the range between levels 118 and 122 is predefined, and this constant-size range shifts up and down as the MAX-STATE threshold 118 changes. When the occupancy level 110 of queue 36 is within this range (between the MAX-STATE threshold 118 and the margin of 122), queue 36 is eligible to receive additional allocations from the shared reserved memory pool 52. (When the occupancy level 110 is below this range, the queue can request allocations from the shared buffer 44. When the occupancy level 110 is above this range, the queue is not eligible to receive any additional allocations from any source.)
[0052] Figure 3 This is a flowchart illustrating, according to an embodiment of the present invention, a method implemented by MMC 56 in network device 20 for allocating memory resources to queue 36.
[0053] This method begins with MMC 56 pre-allocating the memory resources of private reserved memory 48 to queue 36 during the private reservation allocation phase 80. In the packet processing phase 84, packet processor 32 receives packets from network 28 via port 24, processes the packets (including queuing them in queue 36), and sends the processed packets back to network 28 via port 24. During this phase, MMC 56 also performs accounting for various queues relative to the shared buffer.
[0054] In the demand checking phase 88, MMC 56 checks whether any of the queues 36 requires additional memory resources. In this embodiment, the queue requiring additional memory will send an appropriate request to MMC 56. Therefore, MMC can identify if a queue needs additional memory by recognizing the request from the queue. Alternatively, MMC 56 can proactively determine if a queue needs additional memory using any suitable method. If no queue requires additional memory (i.e., if all queues have sufficient available memory in their pre-allocated private reserve allocations), the method loops back to the packet processing phase 84.
[0055] In response to determining that a queue requires additional memory, during the shared buffer eligibility check phase 92, MMC 56 checks whether the queue is eligible for allocation from shared buffer 44. In this embodiment, MMC checks whether the queue's current occupancy (110) is (i) higher than the private reservation threshold 114 and (ii) lower than the MAX-STATE threshold 118. If so, during the shared buffer allocation phase 96, MMC allocates memory resources from shared buffer 44 to the queue. The method then loops back to the packet processing phase 84.
[0056] If the result of stage 92 is that the queue is not eligible for allocation from shared buffer 44, then in shared reserve eligibility check stage 100, MMC 56 checks whether the queue is eligible for allocation from shared reserved memory pool 52. In this embodiment, MMC checks whether the queue's current occupancy (110) is (i) higher than the MAX-STATE threshold 118 and (ii) lower than the margin 122. If so, in shared reserved allocation stage 104, MMC allocates memory from shared reserved memory pool 52 to the queue. The method then loops back to packet processing stage 84.
[0057] If the result of stage 100 is that the queue is not eligible for allocation from the shared reserved memory pool 52, the method loops back to the grouping process stage 84 without allocating any additional memory to the queue.
[0058] Figure 3 The method flow described herein is an example flowchart illustrated purely for conceptual clarity. In alternative embodiments, the techniques disclosed herein can be implemented using any other suitable process.
[0059] For example, this method can be divided into two independent processes that execute in parallel. One process is a shared buffer management process, which allocates memory from shared buffer 44 and adapts it to the MAX-STATE threshold 118. The other process is a shared reservation management process, which allocates memory from shared reserved memory pool 52. Changes to the MAX-STATE threshold 118 affect both processes because they affect two eligibility ranges (eligibility for shared buffer allocation and eligibility for shared reservation allocation). As another example, this method can be used in a shared buffer mechanism that uses a static (i.e., immutable) MAX-STATE threshold.
[0060] As yet another example, MMC 56 can define a hierarchy of shared reserved memory pools 52. This hierarchy can include, for example, a "global" shared reserved pool, plus shared reserved pools for receive (inbound) queues, multicast (MC) queues, transmit (outbound) queues, etc. When a shared reserved pool runs out of memory, MMC can allocate additional memory for that pool from the global shared reserved pool.
[0061] The description up to this point refers to a single shared reserved memory pool 52, the resources of which can be allocated to any of the queues 36 in network device 20. In some embodiments, MMC 56 maintains multiple separate shared reserved memory pools 52 in memory 40. Each shared reserved memory pool 52 is assigned to a respective subset of queues 36. In other words, in these embodiments, MMC 56 allocates shared reserved allocations to a given queue only from the pool 52 of the subset of queues to which the given queue belongs. For example, MMC 52 may maintain a separate pool 52 for the receive queue of each port 48 and / or for the transmit queue of each port. In an example embodiment, a given port 24 is assigned a set of queues 36 corresponding to their respective priority groups, and MMC 56 maintains a shared reserved memory pool 52 for this set of queues. As another example, MMC 52 may maintain a separate pool 52 for any other group (receive or transmit) of queues.
[0062] In the example embodiment, the MMC 56 implements the disclosed technique by executing the following pseudocode section. The current example considers a receive queue Rq[] for a certain port 24. Several priority groups pg[] are defined for this receive queue, and each priority group is assigned a separate queue 36. Therefore, these queues are represented as Rq[],pg[].
[0063] The attributes Rq[], denoted as Rq[].SharedReserve and Rq[].SharedReserveTH, are defined. Rq[].SharedReserve is the total size of the allocations from the shared reserved memory pool 52 to the various queues 36 belonging to Rq[]. Rq[].SharedReserveTH represents the size of the shared reserved pool. Furthermore, the attributes Rq.Pg[].PrivateReserve, Rq.Pg[].PrivateReserveTH, and Rq.Pg[].ReserveEligibleTH are defined for each priority group Pg[] of the receiving queue Rq[]. Rq.Pg[].PrivateReserve is the size of the private reserved allocations allocated to the queue Rq.Pg[]. Rq.Pg[].PrivateReserveTH represents the upper limit threshold for allocating memory from the private reserved pool to the queue. Rq.Pg[].ReserveEligibleTH represents the margin (range) above the MAX-TH threshold, within which the queue is eligible for allocation from the shared reservation pool.
[0064] In this example, the allocation process is performed according to the following pseudocode:
[0065] 1. If Inc. & Rq.pg[].Occupancy < PrivateReserve[] → complete, HaveReserve for Rq.Pg[]
[0066] 2. If Inc. & (Rq.Pg[].PrivateReserveTH[] < (Rq.pg[].Occupancy) < (Rq.Pg[].PrivateReserveTH[] + Rq.Pg[].ReserveEligibleTH)) & (PublishedRq.pg[].AboveMax)
[0067] a. If Rq[].SharedReserve < Rq[].SharedReserveTH
[0068] i. Increase Rq[].SharedReserve by Delta
[0069] ii. Increase Rq.Pg[].PrivateReserve[] by Delta
[0070] b. If Rq[].SharedReserve > Rq[].SharedReserveTH → complete, NoReserve for Rq.Pg[]
[0071] 3. If Dec. & Rq.pg[] & (Rq.Pg[].PrivateReserve[] >
[0072] Rq.Pg[].PrivateReserveTH[])
[0073] a. Decrease Rq.Pp[].PrivateReserve[] by Delta
[0074] b. Decrease Rq[].SharedReserve by Delta
[0075] In parallel, execute an additional "crawler process" according to the following pseudocode:
[0076] 4. If (~Rq.pg[].AboveMax) & (Rq.Pg[].PrivateReserve[] >
[0077] Rq.Pg[].PrivateReserveTH[])
[0078] a. Reduce Delta of Rq.Pp[].PrivateReserve[].
[0079] b. Reduce Rq[].SharedReserve by Delta
[0080] In the pseudocode above, Rq.pg[].Occupancy represents the current occupancy of queue Rq,pg[] (110), Inc. indicates that an increase in the current occupancy has been detected, and Dec. indicates that a decrease in the current queue occupancy has been detected. HaveReserve for Rq.Pg[] This is a result indicating that the queue currently has enough reserved memory, while NoReserve for Rq.Pg [] This is a result indicating that the queue does not have enough reserved memory.
[0081] Published Rq.pg[].AboveMax is a boolean property indicating whether the current occupancy of queue Rq.pg[] is higher than the MAX-STATE threshold of 118. Delta represents the increment of MMC 56 that increases or decreases the reserved allocation.
[0082] It is understood that the embodiments described above are cited by way of example, and the invention is not limited to what is specifically shown and described herein. Rather, the scope of the invention includes combinations and sub-combinations of the various features described herein, as well as variations and modifications thereof that would occur to those skilled in the art upon reading the foregoing description and which are not disclosed in the prior art. Documents incorporated herein by reference should be considered part of this application, and unless the way any term is defined in such incorporated documents conflicts with the express or implied definitions in this specification, only the definitions in this specification should be considered.
Claims
1. A network device, comprising: Multiple ports are used to transmit packets over the network; A packet processor for processing the packets using multiple queues, the multiple queues being a subset of queues; as well as Memory management circuitry, used for: A shared buffer is maintained in memory, and memory resources are adaptively allocated from the shared buffer to the queue; In addition to the shared buffer, multiple independent shared reserved memory pools are maintained in the memory, each pool being used by a corresponding subset from the subset of the queue; Identify queues that meet the following conditions: (i) require additional memory resources, (ii) are not eligible for additional allocation from the shared buffer, and (iii) meet the eligibility conditions of the shared reserved memory pool; as well as Memory resources are allocated from the shared reserved memory pool corresponding to the subset of the queues that includes the identified queues.
2. The network device of claim 1, wherein the memory management circuitry is configured to identify that the queue requires additional memory resources by receiving a request from the queue.
3. The network device of claim 1, wherein the memory management circuitry is configured to identify that the queue is not eligible for additional allocation from the shared buffer by recognizing that the occupancy rate of the queue exceeds a MAX threshold set for the queue.
4. The network device of claim 3, wherein the memory management circuit is configured to verify that the occupancy rate of the queue meets the eligibility criteria of the shared reserved memory pool by verifying that the occupancy rate does not exceed a defined margin higher than the MAX threshold.
5. The network device of claim 1, wherein the memory management circuitry is configured to pre-allocate private reserved memory resources to each of the plurality of queues, regardless of the shared buffer and the shared reserved memory pool.
6. The network device of claim 1, wherein the queues in each subset are associated with the same port of the network device.
7. The network device of claim 1, wherein the plurality of independent shared reserved memory pools include an independent pool for the receive queue of each port and an independent pool for the transmit queue of each port.
8. A memory management circuit in a network device, the memory management circuit comprising: One or more interfaces for communicating with multiple queues of the network device for processing packets and with a memory; as well as Circuit, used for: A shared buffer is maintained in the memory, and memory resources are adaptively allocated from the shared buffer to the queue; In addition to the shared buffer, multiple independent shared reserved memory pools are maintained in the memory, each pool being used by a corresponding subset from a subset of the queue; Identify queues that meet the following conditions: (i) require additional memory resources, (ii) are not eligible for additional allocation from the shared buffer, and (iii) meet the eligibility conditions of the shared reserved memory pool; as well as Memory resources are allocated from the shared reserved memory pool corresponding to the subset of the queues that includes the identified queues.
9. A method for communicating in a network device, the method comprising: Packets are transmitted over a network and processed using multiple queues; A shared buffer and multiple independent shared reserved memory pools are maintained in memory, wherein the shared reserved memory pools are allocated to corresponding subsets of the queue; and Repeat the following operations: Identify (i) queues that require additional memory resources; Check whether the identified queue (ii) is eligible for additional allocation from the shared buffer; If the identified queue is eligible for additional allocation from the shared buffer, allocate additional memory resources from the shared buffer to the identified queue; If the identified queue is not eligible for additional allocation from the shared buffer, check whether the identified queue (iii) meets the eligibility criteria of the shared reserved memory pool corresponding to the subset to which the identified queue belongs; as well as If the eligibility criteria for the shared reserved memory pool are met, memory resources are allocated from the shared reserved memory pool corresponding to the subset to which the identified queue belongs to the identified queue.
10. The method of claim 9, wherein identifying that the queue requires additional memory resources comprises: Receive requests from the queue.
11. The method of claim 9, wherein identifying that the queue is not eligible for an additional allocation from the shared buffer comprises: The occupancy rate of the queue exceeds the MAX threshold set for the queue.
12. The method of claim 11, wherein identifying that the occupancy rate of the queue satisfies the eligibility condition for the shared reserved memory pool comprises: Verify that the occupancy rate does not exceed the defined margin above the MAX threshold.
13. The method of claim 9, further comprising: Private reserved memory resources are pre-allocated to each of the plurality of queues, regardless of the shared buffer and the shared reserved memory pool.
14. The method of claim 9, wherein the queues in each subset are associated with the same port of the network device.
15. A method for memory management in a network device, the method comprising: It communicates with multiple queues of the network device's processing packets and with the memory; A shared buffer is maintained in the memory, and memory resources are adaptively allocated from the shared buffer to the queue; In addition to the shared buffer, multiple independent shared reserved memory pools are maintained in the memory, each pool being used by a corresponding subset from a subset of the queue; Identify queues that meet the following conditions: (i) require additional memory resources, (ii) are not eligible for additional allocation from the shared buffer, and (iii) meet the eligibility conditions of the shared reserved memory pool; as well as Memory resources are allocated from the shared reserved memory pool corresponding to the subset of the queues that includes the identified queues.
16. A method for memory management in a network device that uses queuing to process packets, the method comprising: The memory maintains (i) a shared buffer and (ii) multiple independent shared reserved memory pools, each pool being used by a different corresponding subset of the queue; Identify queues that meet the following conditions: (i) require additional memory resources, (ii) are not eligible for additional allocation from the shared buffer, and (iii) are eligible for allocation from the shared reserved memory pool; and Memory resources are allocated from the shared reserved memory pool corresponding to the subset of the queues that includes the identified queues.