# Patent

## Title
Buffer manager and methods for managing memory

## Abstract

Some of the embodiments of the present disclosure provide a method comprising managing a plurality of buffer addresses in a system-on-chip (SOC); and if a number of available buffer addresses in the SOC falls below a low threshold value, obtaining one or more buffer addresses from a memory, which is external to the SOC, to the SOC. Other embodiments are also described and claimed.

## Background
CROSS REFERENCE TO RELATED APPLICATIONS
The present application claims priority to U.S. patent application Ser. No. 61/315,327, filed Mar. 18, 2010, and U.S. patent application Ser. No. 61/347,947, filed May 25, 2010, the entire specifications of which are hereby incorporated by reference in their entireties for all purposes, except for those sections, if any, that are inconsistent with this specification. The present application is related to U.S. patent application Ser. No. 12/947678 (MP3444), filed Nov. 16, 2010, to U.S. patent application Ser. No. 13/038,279, filed Mar. 1, 2011, and to U.S. patent application Ser. No. 13/038,258, filed Mar. 1, 2011, the entire specifications of which are hereby incorporated by reference in their entirety for all purposes, except for those sections, if any, that are inconsistent with this specification.
TECHNICAL FIELD
Embodiments of the present disclosure relate to buffers in general, and more specifically, to a butler manager and methods for managing memories.
BACKGROUND
Unless otherwise indicated herein, the approaches described in this section are not prior art to the claims in the present disclosure and are not admitted to be prior art by inclusion in this section.
In a conventional computing system, buffer management is generally performed by a processing core. For example, the processing core allocates buffers for buffering data, and releases buffers when the buffered data is emptied from the buffers. These operations consume considerable resources of the processing core.
SUMMARY
In various embodiments, the present disclosure provides a method comprising managing a plurality of buffer addresses in a system-on-chip (SOC); and if a number of available buffer addresses in the SOC falls below a low threshold value, obtaining one or more buffer addresses from a memory, which is external to the SOC, to the SOC. Furthermore, if the number of available buffer addresses in the SOC exceeds a high threshold value, another one or more buffer addresses is allocated from the SOC to the memory. There is also provided a system-on-chip (SOC) comprising a client component; and a buffer management unit (BMU) comprising an internal buffer pointer pool (IBPP); and a controller configured to monitor a number of unassigned buffer pointers in the IBPP, and if the number of unassigned buffer pointers in the IBPP falls below a threshold value, allocate one or more buffer pointers from an external buffer pointer pool (EBPP) to the IBPP. There is also provided a method comprising maintaining a plurality of buffer pointer pools (BPPs), wherein each BPP is logically sectioned in an internal buffer pointer pool (IBPP) and an external buffer pointer pool (EBPP); and for each BPP, dynamically allocating a plurality of buffer pointers to the corresponding IBPP and dynamically allocating another plurality of buffer pointers to the corresponding EBPP.



BRIEF DESCRIPTION OF THE DRAWINGS
In the following detailed description, reference is made to the accompanying drawings which form a part hereof wherein like numerals designate like parts throughout, and in which is shown by way of embodiments that illustrate principles of the present disclosure. It is to be understood that other embodiments may be utilized and structural or logical changes may be made without departing from the scope of the present disclosure. Therefore, the following detailed description is not to be taken in a limiting sense, and the scope of embodiments in accordance with the present disclosure is defined by the appended claims and their equivalents.
FIG. 1 schematically illustrates a packet communication system that includes a system-on-chip comprising a buffer management unit, in accordance with an embodiment of the present disclosure.
FIG. 2 schematically illustrates an example external buffer pointer pool of the packet communication system of FIG. 1, in accordance with an embodiment of the present disclosure.
FIG. 3 schematically illustrates the buffer management unit of FIG. 1 in more detail, in accordance with an embodiment of the present disclosure.
FIG. 4 illustrates an example method for operating the packet communication system of FIGS. 1 and 3, in accordance with an embodiment of the present disclosure.
FIG. 5 illustrates another example method for operating the packet communication system of FIGS. 1 and 3, in accordance with an embodiment of the present disclosure.



DETAILED DESCRIPTION
FIG. 1 schematically illustrates selected parts of a packet communication system 100 (also referred to herein as system 100) that includes a system-on-chip (SOC) 10 comprising a buffer management unit (BMU) 24, in accordance with an embodiment of the present disclosure. Additional parts of the system 100 are not shown to avoid obfuscating teachings of this disclosure. The illustrated SOC 10 also includes one or more processing cores, e.g. processing core 12a, . . . , processing core 12M, where M is an appropriate positive integer.
The system 100 includes one or more network interfaces, e.g., network interface 16a, network interface 16b, . . . , network interface 16P, where P is an appropriate positive integer. One or more of the network interfaces (e.g., network interface 16b) are external to the SOC 10, while one or more of the remaining network interfaces (e.g., network interface 16a, network interface 16c, . . . , network interface 16P) are internal to the SOC 10, as illustrated in FIG. 1. In an embodiment, network interfaces 16a, . . . , 16P are network devices, e.g., a network switch, a network router, a network port, an Ethernet port (e.g., a Gigabyte Ethernet port), a network controller, any appropriate device that has a network connectivity, and/or the like. In an embodiment, the SOC 10 is associated with a network switch or a router. For example, a network switch may be located on the SOC 10.
In an embodiment, the SOC 10 also includes a shared bus 20 that is configured to be operatively coupled to the network interfaces 16a, . . . , 16P, processing cores 12a, . . . , 12M, BMU 24, and a memory controller 40. In various other embodiments and although not illustrated in FIG. 1, instead of the shared bus 20, the SOC 10 includes a plurality of buses, e.g., a dedicated bus between two components of the SOC 10, a bus shared by a few components of the SOC 10, etc. The memory controller 40 is operatively coupled to, and configured to control a memory 44. In an embodiment, the memory controller 40 is configured to receive read and/or write instructions for the memory 44 from the one or more components (e.g., from the BMU 24, one of the processing cores and/or the network interfaces, etc.) via the shared bus 20, and translate the received instructions in a format that is acceptable to the memory 44. That is, the memory controller 40 acts as an interface between the memory 44 and various other components of the system 100 via the shared bus 20. As illustrated in FIG. 1, in an embodiment, the memory 44 is external to the SOC 10, although in other embodiments, the memory 44 is internal to the SOC 10. In an embodiment, the memory 44 is a dynamic random access memory (DRAM) (e.g., a double-data-rate three (DDR3) synchronous dynamic random access memory (SDRAM)).
In an embodiment, the SOC 10 includes a packet processing module 30 configured to process a stream of data packets and perform one or more packet processing functions, e.g., bridging of data packets. Although the SOC 10 typically includes several other components (e.g., one or more peripherals, interfaces, and/or the like), these components are not illustrated in FIG. 1 for the purpose of illustrative clarity. For example, although not illustrated in FIG. 1, the SOC 10 includes various peripherals and physical layer components such as a serializer/deserializer (SERDES) module, one or more ports, a network switch, etc. In an embodiment, the SOC 10 includes various other components based on an application area of the SOC 10.
In an embodiment, the memory 44 includes a plurality of buffer locations, e.g., buffer locations 50—a1, . . . , 50—aR, 50—b1, . . . , 50—bS, . . . , 50_N1, . . . , 50_NT, where R, S, T and N are appropriate positive integers. Each of the buffer locations included in the memory 44 are configured to buffer one or more bytes of data. As an example, each of the buffer locations 50—a1, . . . , 50—aR is configured to store 32 bytes of data, each of the buffer locations 50—b1, . . . , 50—bS is configured to store 256 bytes of data, each of the buffer locations 50_N1, . . . , 50_NT is configured to store 1056 bytes of data, and so on. In an embodiment, one or more of the illustrated buffer locations are contiguous buffer locations in the memory 44.
The processing core 12a, . . . , processing core 12M, network interface 16a, . . . , and/or network interface 16P (and/or one or more other components of the SOC 10, e.g., a interface controller in the SOC 10, an engine in the SOC 10, etc., not illustrated in FIG. 1) receive services from the BMU 24 (e.g., the BMU 24 allocates buffer location to one or more of these components), and accordingly, the processing core 12a, . . . , processing core 12M, network interface 16a, . . . , and/or network interface 16P (and/or any other components that receive service from the BMU 24) are also referred to herein as client components of the BMU 24. When a client component of the BMU 24 receives a data packet and the client component intends to buffer the data packet, the client component transmits an allocation request for a buffer location (also referred to herein as buffer location allocation request, or as buffer allocation request) to the BMU 24. Based on the allocation request, the BMU 24 allocates a buffer location to the client component, as will be discussed in more detail below.
In an embodiment, the BMU 24 is associated with a plurality of buffer pointer pools (BPPs), where each BPP comprises a list of buffer pointers, and where a buffer pointer is an address or a pointer of a corresponding buffer location in the memory 44. For example, although not illustrated in FIG. 1, the system 100 includes BPP—a, . . . , BPP_N, i.e., N number of BPPs. Each BPP is divided into two logical sections: an internal buffer pointer pool (IBPP) and an external buffer pointer pool (EBPP). FIG. 1 illustrates only the IBPPs and the EBPPs, but not the BPPs. As an example, BPP—a is divided into IBPP 32a and EBPP 36a, BPP—b is divided into IBPP 32b and EBPP 36b, BPP_N is divided into IBPP 32N and EBPP 36N, and so on. The IBPPs of various BPPs (i.e., IBPP 32a, IBPP 32b, . . . , IBPP 32N) are stored internally in the BMU 24, as illustrated in FIG. 1. The EBPPs of various BPPs (i.e., EBPP 36a, EBPP 36b, . . . , EBPP 36N) are stored in a location that is external to the BMU 24, e.g., to the memory 44, as illustrated in FIG. 1.
As will be discussed in more detail herein later, in an embodiment, the BMU 24 includes a BMU controller 28 that is configured to monitor, for each IBPP, a number of unassigned buffer pointers (e.g., not assigned to any client component, and is readily available for assignment to a client component) in the IBPP (e.g., IBPP 32a). For example, an unassigned buffer pointer includes a corresponding buffer address that is available for allocation. Although not illustrated in FIG. 1, in an embodiment, for each IBPP, the BMU controller 28 maintains a high threshold value and a low threshold value (although in another embodiment, the BMU controller 28 maintains a shared high threshold value and a shared low threshold value for more than one IBPP). As will be discussed in more detail herein later, for each BPP, the BMU controller 28 dynamically transfers buffer pointers between the corresponding IBPP and the corresponding EBPP, such that a number of unassigned buffer pointers in the IBPP is maintained between the corresponding low threshold value and the high threshold value. For example, if the number of unassigned buffer pointers in the IBPP falls below the low threshold value, the BMU controller 28 allocates one or more buffer pointers from the corresponding EBPP (e.g., EBPP 36a) to the IBPP 32a. On the other hand, if the number of unassigned buffer pointers in the IBPP exceeds a high threshold level, the BMU controller 28 allocates another one or more buffer pointers from the IBPP 32a to the EBPP 36a. Thus, the BMU controller 28 ensures that, for each IBPP, at least a few unassigned buffer pointers are always readily available for allocation to one or more client components (although in one embodiment, when both an IBPP and a corresponding EBPP has no remaining unassigned buffer pointers, an IBPP may not have any buffer pointers readily available for allocation). In other words, at least a few buffers that are managed locally on the SOC 10 are always readily available for allocation to a client component.
Although not illustrated in FIG. 1, in an embodiment, the EBPPs 36a, . . . , 36N are stored in a memory that is different from a memory in which the buffer locations 50—a1, . . . , 50_NT are included. For example, the EBPPs 36a, . . . , 36N and the buffer locations 50—a1, . . . , 50_NT are stored in two or more different memories. In an embodiment, one or more buffer locations can be in different memories, e.g. although not illustrated in FIG. 1, buffer location 50—a1 is in the memory 44, whereas buffer location 50—b1 can be in a memory (either internal or external to the SOC 10) that is different from the memory 44.
As previously discussed, each BPP comprises a list of buffer pointers, where a buffer pointer is an address or a pointer of a corresponding buffer location. For example, BPP—a comprises R number of buffer pointers corresponding to buffer locations 50—a1, 50—a2, . . . , 50—aR, BPP—b comprises S number of buffer pointers corresponding to buffer locations 50—b1, 50—b2 , . . . , 50—bS, BPP_N comprises T number of buffer pointers corresponding to buffer locations 50_N1, 50_N2, . . . , 50_NT , and so on.
The BMU 24 includes the BMU controller 28, which is configured to dynamically allocate buffer pointers associated with a BPP from the EBPP to the IBPP and/or from the IBPP to the EBPP. In an embodiment, the BMU controller 28 stores, corresponding to each IBPP, a count M. For example, the BMU controller 28 stores counts Ma, . . . , MN corresponding to IBPPa, . . . , IBPPN. In an embodiment and as will be discussed in more detail herein later, a count corresponding to an IBPP (e.g., count Ma corresponding to IBPPa) keeps a count of unassigned buffer pointers (e.g., number of unassigned buffer pointers) in the IBPP. The BMU 24 also includes one or more other components (e.g., a transmit port, a receive port, a transmit queue, etc.), which are not illustrated in FIG. 1 for purposes of illustrative clarity.
For each BPP, the BMU 24 (and/or the processing core 12a, processing core 12b, and/or by any other appropriate component of the system 100) initially (e.g., during a startup of the system 100) allocates some of the buffer pointers of the BPP to the corresponding IBPP, and the remaining buffer pointers of the BPP to the corresponding EBPP. For example, of the R buffer pointers included in the BPP—a, R1 buffer pointers are dynamically allocated to IBPP 32a, and remaining R2 buffer pointers are allocated to the EBPP 36a. 
When a client component (e.g., one of the processing cores and/or the network interfaces of FIG. 1, and/or any other appropriate component of system 100, either included in or external to the SOC 10) needs to buffer a data packet to a buffer location, the client component transmits a buffer allocation request to the BMU 24. Based on the received buffer allocation request, the BMU 24 assigns a buffer location to the client component by assigning a buffer pointer from an appropriate IBPP to the client component.
Individual buffer pointers allocated to an IBPP are added to the IBPP list. They are unassigned (e.g., not assigned to any client, and is readily available for assignment to a client component). When an unassigned buffer pointer from an IBPP (e.g., a buffer pointer from the IBPP 32a, corresponding to the buffer location 50—a2) is assigned to a client component, the buffer pointer is removed from the IBPP list, and a number of unassigned buffer pointers in the IBPP is decreased by one. Once the buffer pointer is assigned to the client component, the client component may store or write the data packet in the corresponding buffer location (e.g., in the buffer location 50—a2).
On the other hand, when contents of a buffer location (e.g., buffer location 50—a2) are read by a client component, the buffer location becomes free, i.e., available for future storage. Accordingly, the corresponding buffer pointer (which was earlier assigned to the client component) is released by the BMU 24 (i.e., the buffer pointer is added to IBPP and marked as unassigned), so that the buffer pointer is available for future assignment. That is, based on reading from a buffer location, the corresponding buffer pointer is released, which results in an increase (e.g., an increase of one) in the number of unassigned buffer pointers in the corresponding IBPP.
As previously discussed, a count corresponding to an IBPP (e.g., count Ma corresponding to IBPPa) keeps a count of unassigned buffer pointers in the IBPP. In an embodiment, when a number of unassigned buffer pointers in an IBPP decreases (e.g., decreases due to assignment of buffer pointers from the IBPP to one or more client components) beyond the corresponding low threshold value, the BMU 24 re-allocates one or more buffer pointers from the corresponding EBPP to the IBPP. For example, due to assignment of buffer pointers from the IBPP 32a to one or more client components, the number of unassigned buffer pointers in the IBPP 32a can decrease below the low threshold value. If the number of unassigned buffer pointers in the IBPP 32a decreases beyond the low threshold value, a plurality of buffer pointers is re-allocated from the corresponding EBPP (i.e., EBPP 36a) to the IBPP 32a. The plurality of re-allocated buffer pointers (e.g., 32 buffer pointers) are transmitted from the EBPP 36a to the IBPP 32a, and are stored in the IBPP 32a for possible future allocation to one or more client components. Such re-allocation of buffer pointers, from an EBPP to a corresponding IBPP, ensures that at least a few buffer pointers are always readily available in the IBPP for allocation to one or more client components (i.e., few unassigned buffer pointers are always available in the IBPP). In other words at least a few buffers that are managed locally on the SoC are always readily available for allocation to a client component.
On the other hand, due to release of buffer pointers by one or more client components, the number of unassigned buffer pointers in an IBPP can increase beyond the corresponding high threshold value. If the number of unassigned buffer pointers in an IBPP increases beyond the high threshold value, a plurality of buffer pointers is re-allocated from the IBPP to the corresponding EBPP. Such re-allocation of buffer pointers ensures that an IBPP is not overflowed with unassigned buffer pointers, and that the storage space required by all the IBPPs in the BMU 24 is relatively limited. In other words, the number of buffers that is managed locally on the SoC is limited so as to maintain ease of manageability on the SoC.
In an embodiment, the low threshold value and the high threshold value are configurable. For example, the low threshold and the high threshold values can be configured to ensure that unassigned buffer pointers are always available in the IBPPs, and to also ensure a relatively small storage space required in the SOC 10 to store the buffer pointers of the IBPPs.
Transmission of buffer pointers between an IBPP and a corresponding EBPP (e.g., during re-allocation of buffer pointers) can take place in batches of buffer pointers. For example, 32 buffer pointers are re-allocated and transmitted as a single batch from EBPP 36a to IBPP32a, or vice versa (e.g., the 32 buffer pointers are transmitted in a single transaction or as a single transmission, from the EBPP 36a to the IBPP 32a, or vice versa). In an embodiment, such batch transmission of buffer pointers (e.g., instead of separately transmitting the 32 buffer pointers) reduces the number of transactions to the memory 44, the load on bus20, the load on memory controller 40, and/or bandwidth requirement for the transmission.
In an embodiment, in some situations, one or more buffer pointers can also be assigned to one or more client components directly from an EBPP. For example, if unassigned buffer pointers in an IBPP are exhausted (e.g., exhausted rapidly due to rapid assignment of several buffer pointers to client components) before re-allocation and transmission of a batch of buffer pointers from the corresponding EBPP to the IBPP, then one or more buffer pointers can be assigned to one or more client components directly from the EBPP.
In an embodiment, the SOC 10 processes data packets received from, for example, a plurality of traffic flows originating from outside the SOC 10. Sizes of data packets, which are processed by the SOC 10, can vary considerably. In an embodiment, selection of an IBPP for assigning a buffer pointer is based at least in part on a size of a data packet that is to be buffered. For example, individual buffer locations associated with a single BPP are of similar sizes, while buffer locations associated with different BPPs are of different sizes. For example, each of the buffer locations 50—a1, . . . , 50—aR, associated with BPP—a, has 32 bytes storage capacity. On the other hand, each of the buffer locations 50—b1, . . . , 50—bS, associated with BPP—b, has 256 bytes storage capacity. Accordingly, when a client component (e.g., network interface 16a) wants to buffer a 16 byte data packet, the BMU 24 assigns a buffer pointer from IBBP 32a (i.e., assigns one of the buffer locations 50—a1, . . . , 50—aR) to the client component. However, when the client component wants to buffer a 128 byte data packet, the BMU 24 assigns a buffer pointer from IBBP 32b (i.e., assigns one of the buffer locations 50—b1, . . . , 50—bS) to the client component.
In an embodiment, for a multi-core system (such as the SOC 10), each BPP is associated with a corresponding processing core. For example, processing core 12a is assigned BPP—a (i.e., IBPP 32a assigns buffer pointers to the processing core 12a), processing core 12b is assigned BPP—b (i.e., IBPP 32b assigns buffer pointers to the processing core 12b), and so on. That is, each processing core has its own buffer area. Thus, in an embodiment, buffer pointer pool allocation is based on an origin of the data packets that are to be buffered (e.g., whether the data packets are originated from processing core 12a, processing core 12b, and/or the like).
In an embodiment, selection of an IBPP for assigning a buffer pointer can be based on any other appropriate criterion.
In an embodiment, management and/or assignment of buffer pointers by the BMU 24 requires minimal or no supervision by the processing cores 12a, . . . , 12M. That is, the use of BMU 24 relieves the processing cores from buffer management and/or assignment duties, thereby considerably saving processing power of the processing cores. In contrast, in a conventional buffer management system, generally a processing core is involved in buffer management and/or assignment.
Maintaining an IBPP and a corresponding EBPP, and assigning buffer pointers from the IBPP (e.g., instead of assigning from the EBPP) has several advantages. For example, one or more of the client components and the IBPP are all located within the SOC 10. Accordingly, an assignment of a buffer pointer from the IBPP to a client component is relatively faster compared to an assignment of a buffer pointer from the EBPP to the client component. Furthermore, maintaining the EBPP (e.g., instead of storing all the buffer pointers in the IBPPs) ensures a relatively small storage size required for storing the buffer pointers of the IBPPs (as storage in the SOC 10 is relatively limited in comparison to storage in the memory 44, which is external to the SOC 10).
In an embodiment, a descriptor associated with a buffer location includes a physical address and a virtual address of the buffer location. In an embodiment, the BMU24 assigns and/releases buffer pointers by using its physical address. In another embodiment, each buffer location (e.g. buffer location 50—a1) includes both physical and virtual address, so when the BMU24 assigns and/or releases buffer pointer, both physical and virtual address are assigned and/or released.
Another way to handle the virtual address is to write each virtual address to the buffer itself (e.g., written during a system initialization phase). In this way the BMU 24, when allocating buffer pointers, transmits only the physical address of the buffer to the client. Then the client, if it needs the virtual address of the buffer, can read the virtual address of the buffer from the buffer itself (e.g. from the first 4 bytes of the buffer, if the virtual address is 32 bit length).
In a conventional system, a processing core generally manages buffer assignments. As a processing core usually deals with virtual addresses, in such a conventional system, the processing core only keeps track of a virtual address of a buffer location. In contrast, the buffer locations in the system 100 are accessed by the processing cores, network interfaces, BMU 24, and/or by any appropriate client components of the BMU 24. In an example, the network interfaces and/or the BMU 24 access the buffer locations using physical addresses of the buffer locations, and the processing cores access the buffer locations using virtual addresses of the buffer locations. Accordingly, the BMU 24 maintains both the physical and virtual addresses of the buffer locations in the corresponding buffer location descriptors, thereby enabling seamless access of the buffer locations by both the processing cores and the network interfaces (and/or by any other client component of the BMU 24).
FIG. 2 schematically illustrates an example EBPP (e.g., EBPP 36a) of the system 100 of FIG. 1, in accordance with an embodiment of the present disclosure. As an example, EBPP 36a includes eight buffer pointers 210a, . . . , 210h, although in other embodiments, the EBPP 36a can include any other appropriate number of buffer pointers.
The buffer pointers 210c, . . . , 210e, illustrated without any shading, are available for possible re-allocation to the IBPP 32a. The buffer pointers 210a, 210b, 210f, . . . , 210h (e.g., the buffer pointers between the head and the tail addresses) are unavailable for re-allocation (e.g., as they are not part of the buffer pointer list), and are illustrated using grey shading. Although FIG. 2 illustrates the EBPP 36a storing the buffer pointers (e.g., buffer pointers 210a, 210b, 210f, . . . , 210h) that have already been allocated to the IBPP 32a, in an embodiment, the EBPP 36a does not store these buffer pointers.
In an embodiment, the buffer pointers included in the EBPP 36a have sequential addresses. For example, an address of the buffer pointer 210b can be generated by incrementing an address of the buffer pointer 210a, an address of the buffer pointer 210c can be generated by incrementing an address of the buffer pointer 210b, and so on. A start address associated with the EBPP 36a refers to an address (e.g., a virtual address and/or a physical address) of a first buffer pointer (e.g., buffer pointer 210a) of the EBPP 36a. A stop address associated with the EBPP 36a refers to an address (e.g., a virtual address and/or a physical address) of a last buffer pointer (e.g., buffer pointer 210h) of the EBPP 36a. As buffer pointers are re-allocated from the EBPP 36a to the IBPP 32a (or vice versa) in a batch, in an embodiment, contiguous buffer pointers 210c, . . . , 210e of the EBPP 36a are available for possible re-allocation to the IBPP 32a. A head address associated with the EBPP 36a refers to an address (e.g., a virtual address and/or a physical address) of a first buffer pointer (e.g., buffer pointer 210c) of a plurality of buffer pointers (e.g., buffer pointers 210c, 210d, 210e), which are available for re-allocation to the IBPP 32a. A tail address associated with the EBPP 36a refers to an address (e.g., a virtual address and/or a physical address) of a last buffer pointer (e.g., buffer pointer 210e) of a plurality of buffer pointers (e.g., buffer pointers 210c, 210d, 210e), which are available for re-allocation to the IBPP 32a. The head and tail addresses of the EBPP 36a dynamically changes with allocation and/or re-allocation of buffer pointers between the IBPP 32a and the EBPP 36a. 
In an embodiment, the BMU 24 stores the start and stop addresses, and the current head and tail addresses of the EBPP 36a. Based on these addresses, the BMU 24 is aware of a number of buffer pointers available in the EBPP 36a for possible re-allocation to the IBPP 32a. For example, a difference between a head address and a tail address is an indication of a number of buffer pointers available for re-allocation to the IBPP 32a. 
Although not illustrated in FIG. 2, individual IBPPs also include corresponding start, stop, head and tail addresses. For example, a head address of an IBPP refers to an address of a first buffer pointer of a plurality of buffer pointers, which are available for assignment to a client component. Similarly, a tail address of an IBPP refers to an address of a last buffer pointer of a plurality of buffer pointers, which are available for assignment to a client component. As previously discussed, a count corresponding to an IBPP (e.g., count Ma corresponding to IBPPa) keeps a count of unassigned buffer pointer in the IBPP. For example, count Ma keeps a count of a number of unassigned buffer pointers in the IBPPa by keeping a count of buffer pointers between a head address and a tail address of the IBPPa.
FIG. 3 schematically illustrates the BMU 24 of FIG. 1 in more detail, in accordance with an embodiment of the present disclosure. The BMU 24 includes an IBPP storage unit 32, which stores the IBPP 32a, . . . , IBPP 32N. The BMU 24 also includes the BMU controller 28, a BMU direct memory access (DMA) 312 and registers files 316.
Referring to FIGS. 1 and 3, in an embodiment the BMU 24 also includes a receive port 304, which is configured to receive data and/or instructions from one or more client components (e.g., the network interface 16c, not illustrated in FIG. 3) and/or the memory 44, via the shared bus 20. For example, the BMU 24 receives buffer allocation requests and buffer release requests from one or more client components, and also receives re-allocated buffer pointers from one or more EBPPs, as previously discussed. The BMU 24 also includes a multiplexer 344, a transmit queue 324 (e.g., a first-in first-out queue), and a transmit port 328.
Data and/or instructions received in the receive port 304 of the BMU 24 is queued in a receive queue 320 (e.g., a first-in first-out queue), and selectively transmitted to the BMU controller 28, to one of the IBPPs, to the BMU DMA 312, and/or to registers files 316.
The BMU controller 28 includes a buffer pointer address pool 308, which is configured to store start addresses, stop addresses, head addresses and/or tail addresses of various IBPPs and EBPPs. The BMU controller 28 also includes a write logic 348, a read logic 352, and a multiplexer 340.
In an embodiment, the BMU controller 28 keeps track of unassigned buffer pointers in each of the IBPPs and EBPPs, e.g., by monitoring various addresses in the buffer pointer address pool 308. Based on comparing a number of unassigned buffer pointers in an IBPP with the previously discussed high and low thresholds, the BMU controller 28 determines if buffer pointers are to be re-allocated, either from the IBPP to a corresponding EBPP, or from the EBPP to the IBPP. In the case of such re-allocation of the buffer pointers from the EBPP to the IBPP, the BMU DMA 312 transmits a pull request to the EBPP, via the multiplexer 344, the transmit queue 324, and the transmit port 328.
If buffer pointers are to be re-allocated from an IBPP to a corresponding EBPP, the BMU DMA 312 transmits a push request (e.g., to facilitate re-allocation of buffer pointers from an IBPP to a corresponding EBPP) to the IBPP, via the multiplexer 340 and the read logic 352. Based on receiving the push request, the IBPP transmits the re-allocated buffer pointers, via multiplexer 344, transmit queue 324, and the transmit port 328, to the corresponding EBPP in the memory 44. The multiplexer 344 selectively multiplexes inputs from the IBPP storage unit 32, the BMU DMA 312 and the register files 316 based on, for example, when the input from one of these components are enabled.
When the BMU controller 28 receives a buffer allocation request, the BMU controller 28 selects an appropriate BPP based on, for example, a size of a data packet that is to be buffered, the client component from which the request is received, numbers of unassigned buffer pointers available in various IBPPs, and/or the like. The IBPP corresponding to the selected BPP receives the allocation request via the multiplexer 340 and the read logic 352, and transmits the allocated buffer pointer to the client component via multiplexer 344, transmit queue 324, and the transmit port 328.
When the BMU controller 28 receives a buffer release request, the corresponding IBPP (e.g., the IBPP whose buffer pointer is to be released) receives the release request via the write logic 348 (e.g., which transmits the release request to the IBPP storage unit 32), and releases the buffer pointer by writing the buffer pointer to the IBPP list.
The register files 316 are configured to store various configuration information associated with the BMU 24. In an example, the register files 316 communicates with the BMU controller 28, receives information that are received by one or more other components of the BMU 24, and periodically updates various configuration information stored in the register files 316.
FIG. 4 illustrates an example method 400 for operating the system 100 of FIGS. 1 and 3, in accordance with an embodiment of the present disclosure. At 404, the BMU 24 (e.g., the BMU controller 28) allocates (e.g., allocates a first plurality of buffer pointers and a second plurality of buffer pointers to an IBPP (e.g., IBPP 32a) and an EBPP (e.g., EBPP 36a), respectively, where a BPP (e.g., BPP—a) comprises the IBPP and the EBPP.
Subsequent to such an allocation, the BMU 24 receives either an allocation request at 408, or a release request at 430. For example, at 408, the BMU 24 receives an allocation request for a buffer location from a first component (e.g., from the network interface 16a). At 412, the BMU 24 assigns a first buffer location to the first component by assigning a corresponding first buffer pointer of the first plurality of buffer pointers from the IBPP 32a to the first component. In an embodiment, the BMU 24 deletes the first buffer pointer from the unassigned buffer pointer list, in response to assigning the first buffer location.
At 416, the BMU 24 determines whether a number of unassigned buffer pointers in the IBPP 32a is less than a low threshold value. If the number of unassigned buffer pointers is not less than the low threshold value (i.e., no at 416), the method loops back to one of the operations at 408 or 430. On the other hand, if the number of unassigned buffer pointers is less than the low threshold value (i.e., yes at 416), at 420 the BMU 24 dynamically re-allocates a third plurality of buffer pointers of the second plurality of buffer pointers from the EBPP 36a to the IBPP 32a (e.g., re-allocates a plurality of buffer pointers from the EBPP 36a to the IBPP 32a). Subsequent to 420, the method loops back to one of the operations at 408 or 430.
Referring again to operations at 430, the BMU 24 receives the release request from a second component (e.g., processing core 12a), requesting to release a second buffer location associated with a second buffer pointer of the first plurality of buffer pointers. In an example, the second buffer location was previously assigned by the BMU 24 to the second component. At 434, the BMU 24 releases the second buffer location, and marks the second buffer pointer as unassigned. At 438, the BMU 24 determines whether a number of unassigned buffer pointers in the IBBP 32a is greater than a high threshold value. If the number of unassigned buffer pointers in the IBBP 32a is not greater than the high threshold value (i.e., no at 438), the method loops back to one of the operations at 408 or 430. If, on the other hand, the number of unassigned buffer pointers in the IBBP 32a is greater than the high threshold value (i.e., yes at 438), at 442 the BMU 24 dynamically re-allocates a fourth plurality of buffer pointers of the second plurality of buffer pointers from the IBPP 32a to the EBPP 36a (e.g., re-allocates a plurality of buffer pointers from the IBPP 32a to the EBPP 36a). Subsequent to 442, the method loops back to one of the operations at 408 or 430.
FIG. 5 illustrates another example method 500 for operating the packet communication system of FIGS. 1 and 3, in accordance with an embodiment of the present disclosure. Referring to FIGS. 1, 3 and 5, at 504, the BMU controller 28 manages a plurality of buffer addresses in an SOC (e.g., manages a corresponding plurality of buffer pointers in an internal buffer pointer pool (e.g., IBPP 32a) of the SOC 10). At 508, the BMU controller 28 determines if the number of available buffer addresses in the SOC (e.g., if the number of unassigned buffer pointers in the internal buffer pointer pool) falls below a low threshold value or exceeds a high threshold value. If, at 508, the number of available buffer addresses in the SOC falls below the low threshold value, then at 512 the BMU controller 28 allocates one or more buffer addresses from an external memory (e.g., from an external buffer pointer pool, e.g., EBPP 36a in the memory 44) to the SOC (e.g., to the IBPP 32a), and then continues the monitoring at 504. On the other hand, if, at 508, the number of available buffer addresses in the SOC exceeds the high threshold value, then at 516 the BMU controller 28 allocates another one or more buffer addresses from the SOC to the external memory, and then continues the monitoring at 504. Furthermore, if, at 508, the number of available buffer addresses in the SOC is between the low threshold value and the high threshold value, the method continues the monitoring at 504.
Although specific embodiments have been illustrated and described herein, it is noted that a wide variety of alternate and/or equivalent implementations may be substituted for the specific embodiment shown and described without departing from the scope of the present disclosure. The present disclosure covers all methods, apparatus, and articles of manufacture fairly falling within the scope of the appended claims either literally or under the doctrine of equivalents. This application is intended to cover any adaptations or variations of the embodiment disclosed herein. Therefore, it is manifested and intended that the present disclosure be limited only by the claims and the equivalents thereof.

## Claims

1. A method comprising:
managing a first internal buffer pointer pool and a second internal buffer pointer pool of a system-on-chip (SOC); and
if a number of available buffer addresses in the first internal buffer pointer pool falls below a first low threshold value, obtaining one or more buffer addresses from a first external buffer pointer pool of a memory, which is external to the SOC, to the first internal buffer pointer pool;
if a number of available buffer addresses in the second internal buffer pointer pool falls below a second low threshold value, obtaining another one or more buffer addresses from a second external buffer pointer pool of the memory to the second internal buffer pointer pool;
associating the first internal buffer pointer pool with a first traffic flow such that available buffer addresses from the first internal buffer pointer pool are assigned to data packets of the first traffic flow, wherein the first traffic flow originates from a first client component; and
associating the second internal buffer pointer pool with a second traffic flow such that available buffer addresses from the second internal buffer pointer pool are assigned to data packets of the second traffic flow, wherein the second traffic flow originates from a second client component,
wherein obtaining the one or more buffer addresses from the first external buffer pointer pool to the first internal buffer pointer pool further comprises:
receiving an allocation request for a buffer location from the first client component,
in response to receiving the allocation request, assigning a first buffer address from the first internal buffer pointer pool to the first client component by assigning a first buffer pointer from the first internal buffer pointer pool to the first client component, wherein the first buffer pointer includes the first buffer address,
in response to assigning the first buffer address to the first client component, marking the first buffer address as an unavailable buffer address in the first internal buffer pointer pool,
in response to marking the first buffer address as an unavailable buffer address, if the number of available buffer addresses in the first internal buffer pointer pool falls below the low threshold value, obtaining the one or more buffer addresses from the first external buffer pointer pool to the first internal buffer pointer pool,

wherein the method further comprises buffering, by the first client component, a data packet received by the first client component to a buffer location corresponding to the first buffer address, based at least in part on assigning the first buffer address to the first client component.

2. The method of claim 1, further comprising:
if the number of available buffer addresses in the first internal buffer pointer pool exceeds a high threshold value, allocating a first one or more buffer addresses from the first internal buffer pointer pool to the first external buffer pointer pool.

3. The method of claim 1, wherein said managing the first internal buffer pointer pool further comprises:
managing a plurality of buffer pointers in the first internal buffer pointer pool, wherein a buffer pointer of the plurality of buffer pointers includes a corresponding buffer address.

4. A method comprising:
managing a plurality of buffer addresses in a first internal buffer pointer pool of a system-on-chip (SOC);
if a number of available buffer addresses in the first internal buffer pointer pool falls below a low threshold value, obtaining one or more buffer addresses from an external buffer pointer pool of memory, which is external to the SOC, to the first internal buffer pointer pool;
receiving an allocation request for a buffer location from a client component to buffer a data packet received by the client component;
selecting, in response to the allocation request, one of the first internal buffer pointer pool and a second internal buffer pointer pool for allocating a buffer address to the client component, based at least in part on (i) a size of the data packet, (ii) a size of a buffer location associated with the first internal buffer pointer pool, and (iii) a size of a buffer location associated with the second internal buffer pointer pool; and
assigning a buffer address, associated with the selected internal buffer pointer pool, to the client component by assigning a corresponding buffer pointer to the client component.

5. The method of claim 2, wherein said allocating the first one or more buffer addresses further comprises:
receiving a release request from the first client component, requesting to release a first buffer location associated with a second buffer address;
releasing the first buffer location in response to the release request;
marking the second buffer address as an available buffer address in the first internal buffer pointer pool, in response to releasing the first buffer location; and
in response to marking the second buffer address as an available buffer address in the first internal buffer pointer pool, if the number of available buffer addresses in the first internal buffer pointer pool exceeds the high threshold level, allocating the first one or more buffer addresses from the first internal buffer pointer pool to the first external buffer pointer pool.

6. The method of claim 1, wherein said one or more buffer addresses comprises a first plurality of buffer addresses, wherein said obtaining the first plurality of buffer addresses from the first external buffer pointer pool to the first internal buffer pointer pool further comprises:
transmitting the first plurality of buffer addresses from the first external buffer pointer pool to the first internal buffer pointer pool as a single transaction between the first external buffer pointer pool and the first internal buffer pointer pool.

7. A system-on-chip (SOC) comprising:
a client component; and
a buffer management unit (BMU) comprising:
a first internal buffer pointer pool (IBPP);
a second IBPP; and
a controller configured to:
monitor (i) a number of unassigned buffer pointers in the first IBPP and (ii) a number of unassigned buffer pointers in the second IBPP,
if the number of unassigned buffer pointers in the first IBPP falls below a first threshold value, allocate a first one or more buffer pointers from a first external buffer pointer pool (EBPP) to the first IBPP, wherein each of the first one or more buffer pointers in the first IBPP points to corresponding buffer locations of a memory that is external to the SOC,
if the number of unassigned buffer pointers in the second IBPP falls below a second threshold value, allocate a second one or more buffer pointers from a second EBPP to the second IBPP, and
if the number of unassigned buffer pointers in the first IBPP exceeds a high threshold value, allocate a third one or more buffer pointers from the first IBPP to the first EBPP.

8. The SOC of claim 7, wherein the client component is a processing core that is separate from the BMU.

9. The SOC of claim 7, wherein the client component is a network interface.

10. The SOC of claim 7, wherein the first EBPP is stored in a memory that is external to the SOC.

11. The method of claim 1, wherein each of the first client component and the second client component is one of a processing core and a network interface.