Packet processing system, method and apparatus for optimizing packet buffer space

By configuring the buffer logic unit in the packet processing device, the underused pages are allocated to multiple packets, the problems of packet memory space waste and bandwidth pressure are solved, and the system efficiency is improved.

CN113886282BActive Publication Date: 2025-03-14MARVELL ASIA PTE LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111183014.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2015-03-30
Filing Date
2016-03-29
Publication Date
2025-03-14
Estimated Expiration
2036-03-29

AI Technical Summary

Technical Problem

In packet processing devices, the prior art has problems of waste and bandwidth pressure in the utilization of packet memory space, especially in the tradeoffs between page size and access frequency.

Method used

By configuring the buffer logic unit, if the current packet stored on the page does not fully fill the page, a single page is allocated to two or more packets, thereby reducing unused space in the page and reducing waste of packet memory space.

Benefits of technology

This method effectively reduces the waste of packet memory space, reduces the bandwidth pressure of the buffer manager, and improves the efficiency of the packet processing system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113886282B_ABST
    Figure CN113886282B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure relate to packet processing systems, methods, and devices for optimizing packet buffer space. A buffer logic unit of a packet processing device is configured to allocate a single page to two or more packets if the current packet stored on the page does not completely fill up the single page, and store and maintain page status data specific to a page segment for each of the packet data stored on the page.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] Related Applications

[0002] This application is a divisional application of the invention patent application with application number 201610188963.8, application date March 29, 2016, and invention name “Packet processing system, method and device for optimizing packet buffer space”. Technical Field

[0003] The present invention relates to a packet processing system. More particularly, the present invention relates to optimizing packet buffer space in a packet processing system. Background Art

[0004] Packet processing devices (such as switch microchips) often need to buffer packets in a packet memory (PM) having one or more banks as the device processes them. The current solution for storing packets in the packet memory of the device is to assign multiple chunks (called pages) of packet memory to each packet, rather than a single large chunk. With this scheme, packets are not stored contiguously in the banks of the packet memory, but are scattered across one or more pages, which together form a linked list of pages that are mapped across multiple banks of the packet memory. Further, a plurality of these banks (and the pages mapped to them) can be logically grouped into pools (of banks and associated pages). Therefore, a linked list of all pages used in the packet buffer by a particular packet needs to be maintained in the switch (in the buffer manager or BM); this linked list is traversed when the packet is read out of the packet buffer for transmission. Each page has associated with it a state, which contains some information about the page. The state of all pages in the packet processor device is maintained in the switch. The packet is associated with a descriptor or token that contains, among other fields, a pointer to the first page. Using this starting pointer, all pages used by the packet can be retrieved in the same order they were used to store the incoming packet by traversing a linked list constructed using next page pointers of different page states. As a result, a linked list of all pages (and therefore, banks) used by a particular packet is maintained in the switch and then traversed to locate and read out packets from the packet memory for transmission.

[0005] In these page-based packet processing devices, there is a tradeoff between wasted packet memory and the bandwidth requirements imposed on the buffer manager. The larger the size of each of the pages, the fewer accesses are required to read and write packet data, and therefore the less pressure on the bandwidth of the buffer manager. However, the larger the size of the page means that a larger portion of the packet memory may be wasted or unused, because packets that do not fill the entire page will cause the remainder of the page to be unused. On the other hand, the smaller the page size, the less packet memory is wasted or unused on average, but due to the increase in the number of accesses required to read and write each packet to the smaller page, the pressure applied to the buffer manager is greater.

[0006] In addition, in some packet processing devices, if a portion of two or more packets has a matching portion of packet data (e.g., a header portion or a body portion), the packets can share one or more pages storing the matching portion of the packet data, so that the matching data is not stored twice in different locations (e.g., different pages). In order to keep track of the number of packets that need to use a page, the buffer manager maintains a reference count value for each page in the page, which indicates the number of pages that share the page and from which packet data has not yet been read. For example, when the device determines that more packets need to use a page (e.g., more packets have a portion that matches the portion of the data stored on the page), the device can increment the reference count value to account for the added packets that need to use the page. Similarly, when data is read from the pages for one or more of the packets in the group (so that the page no longer needs to be used for these packets), the device can decrement the reference count value to account for the smaller number of packets that need to use the page. Therefore, when the reference count is reduced to zero, the device can reclaim the page for reuse with other data because no more packets need to use the data stored on the page. Summary of the invention

[0007] A buffer logic unit of a packet processing device is configured to allocate a single page to two or more packets if the current packet stored on the page does not completely fill the page. As a result, the buffer logic unit can reduce the amount of wasted packet memory space by reducing the amount of unused space on each of the pages.

[0008] A first aspect is directed to a packet processing system on a packet processing device. The system includes: a non-volatile computer-readable packet memory including a plurality of physical memory cells, the plurality of physical memory cells being logically divided into a plurality of pages, whereby each of the pages defines a separate portion of the physical memory cells; and a buffer logic stored at least in part on a non-volatile computer-readable buffer memory, wherein the buffer logic is configured to: allocate a page in a page to store packet data of a first group in a plurality of packets; and if the page in a page is determined to be insufficiently occupied by the packet data of the first group, allocate at least a portion of the unoccupied remainder of the page in the page to store packet data of one or more additional groups in the plurality of packets, so that the page in the page is allocated to two or more of the plurality of packets. In some embodiments, each of the pages includes a plurality of segments, and if the unoccupied remainder includes at least one segment of the segments of the page in the page, the buffer memory logic determines that the page in the page is insufficiently occupied. In some embodiments, the buffer memory includes a reference count value for each of the pages, the reference count value indicating how many of the plurality of packets use the page, and further wherein the buffer logic is configured to, once the page of the pages has been allocated to store packet data of a first packet, set the reference count value of the page of the pages to an integer greater than one if the page of the pages is determined to be underfilled after storing the packet data of the first packet. In some embodiments, the integer greater than one is two. In some embodiments, for each of the plurality of packets whose packet data is allocated to the page of the pages, the buffer logic is configured to increment the reference count value of the page of the pages by one if the page of the pages is determined to be underfilled after storing the packet data of the packet. In some embodiments, for each of the plurality of packets whose packet data is allocated to the page of the pages, the buffer logic is configured to avoid incrementing the reference count value of the page of the pages by one if the page of the pages is determined to no longer be underfilled after storing the packet data of the packet. In some embodiments, the buffer memory stores status data for each of the pages, wherein the status data for each of the pages includes a separate status value for each of the segments of the page. In some embodiments, the status value for each of the segments includes one or more of the following group, the group including: a used data count value indicating how much of the segment is currently storing data; a packet start value indicating whether the start of one of the packets is stored in the segment; and a packet end value indicating whether the end of one of the packets is stored in the segment.In some embodiments, the buffer logic is configured to generate a descriptor for each of the packets stored on one or more of the pages, wherein the descriptor includes a page indicator indicating on which page of the pages the start of the packet is stored, and a segment indicator indicating on which segment of the segments of the indicated pages the start of the packet is stored. In some embodiments, for each of the packets, after storing an end of the packet (e.g., an end of a header or an end of the entire packet) on one of the segments of the pages of the pages, the buffer logic reserves one or more of the adjacent subsequent segments of the page as reserved segments, the reserved segments being capable of storing data from the packet only when the size of the data of the packet increases. In some embodiments, when determining whether the page of the page is not fully occupied, the buffer logic considers the reserved segments as occupied so that the reserved segments are not part of the unoccupied remainder.

[0009] A second aspect is directed to a buffer logic unit stored on a non-transitory computer-readable buffer memory, wherein the buffer logic is configured to: allocate a page of a plurality of pages to store packet data of a first group of a plurality of groups; and if the page of the page is determined to be under-occupied by the packet data of the first group, allocate at least a portion of an unoccupied remainder of the page of the page to store packet data of one or more additional groups of the plurality of groups, such that the page of the page is allocated to two or more of the plurality of groups, wherein each of the plurality of pages includes a plurality of segments and defines separate portions of a plurality of physical memory cells. In some embodiments, each of the pages includes a plurality of segments, and if the unoccupied remainder includes at least one of the segments of the page of the page, the buffer memory logic determines that the page of the page is under-occupied. In some embodiments, the buffer memory includes a reference count value for each of the pages, the reference count value indicating how many of the plurality of packets use the page, and further wherein the buffer logic is configured to, once the page of the pages has been allocated to store packet data of a first packet, set the reference count value of the page of the pages to an integer greater than one if the page of the pages is determined to be underfilled after storing the packet data of the first packet. In some embodiments, the integer greater than one is two. In some embodiments, for each of the plurality of packets whose packet data is allocated to the page of the pages, the buffer logic is configured to increment the reference count value of the page of the pages by one if the page of the pages is determined to be underfilled after storing the packet data of the packet. In some embodiments, for each of the plurality of packets whose packet data is allocated to the page of the pages, the buffer logic is configured to avoid incrementing the reference count value of the page of the pages by one if the page of the pages is determined to no longer be underfilled after storing the packet data of the packet. In some embodiments, the buffer memory stores status data for each of the pages, wherein the status data for each of the pages includes a separate status value for each of the segments of the page. In some embodiments, the status value for each of the segments includes one or more of the following group, the group including: a used data count value indicating how much of the segment is currently storing data; a packet start value indicating whether the start of one of the packets is stored in the segment; and a packet end value indicating whether the end of one of the packets is stored in the segment.In some embodiments, the buffer logic is configured to generate a descriptor for each of the packets stored on one or more of the pages, wherein the descriptor includes a page indicator indicating on which page of the pages the start of the packet is stored, and a segment indicator indicating on which segment of the segments of the indicated pages the start of the packet is stored. In some embodiments, for each of the packets, after storing the end of the packet on one of the segments of the pages, the buffer logic reserves one or more of the adjacent subsequent segments of the page as reserved segments, the reserved segments being capable of storing data from the packet only when the size of the data of the packet increases. In some embodiments, when determining whether the page of the pages is not fully occupied, the buffer logic considers the reserved segments as occupied so that the reserved segments are not part of the unoccupied remainder.

[0010] A third aspect is directed to a method for optimizing packet memory space within a packet processing system, the packet processing system comprising a non-transitory computer-readable packet memory, the non-transitory computer-readable packet memory comprising a plurality of physical memory cells, the plurality of physical memory cells being logically divided into a plurality of pages, whereby each of the pages defines a separate portion of the physical memory cells. The method comprises: allocating a page of a page using buffer logic to store packet data of a first packet of a plurality of packets, wherein the buffer logic is at least partially stored on a non-transitory computer-readable buffer memory; determining using the buffer logic whether the page of the page is not fully occupied by the packet data of the first packet; and if the page of the page is determined by the buffer logic to be not fully occupied by the packet data of the first packet, allocating at least a portion of the unoccupied remainder of the page of the page using the buffer logic to store the packet data of one or more additional packets of the plurality of packets, so that the page of the page is allocated to two or more packets of the plurality of packets. In some embodiments, each of the pages comprises a plurality of segments, and if the unoccupied remainder comprises at least one segment of the segments of the page of the page, the buffer memory logic determines that the page of the page is not fully occupied. In some embodiments, the buffer memory includes a reference count value for each of the pages, the reference count value indicating how many of the plurality of packets use the page, and the method further includes: once the page of the pages has been allocated to store the packet data of the first packet, if the page of the pages is determined to be underfilled after storing the packet data of the first packet, setting the reference count value of the page of the pages to an integer greater than one. In some embodiments, the integer greater than one is two. In some embodiments, the method further includes: for each of the plurality of packets whose packet data is allocated to the page of the pages, if the page of the pages is determined to be underfilled after storing the packet data of the packet, incrementing the reference count value of the page of the pages by one using the buffer logic. In some embodiments, the method further includes: for each of the plurality of packets whose packet data is allocated to the page of the pages, if the page of the pages is determined to no longer be underfilled after storing the packet data of the packet, avoiding incrementing the reference count value of the page of the pages by one using the buffer logic. In some embodiments, the method further includes storing, with the buffer logic, state data for each of the pages in the buffer memory, wherein the state data for each of the pages includes a separate state value for each of the segments of the page.In some embodiments, the state value for each of the segments includes one or more of the following group, the group including: a used data count value indicating how much of the segment is currently storing data; a packet start value indicating whether the start of one of the packets is stored in the segment; and a packet end value indicating whether the end of one of the packets is stored in the segment. In some embodiments, the method further includes: generating, using buffer logic, a descriptor for each of the packets stored on one or more of the pages, wherein the descriptor includes a page indicator and a segment indicator, the page indicator indicating which page of the page the start of the packet is stored on, and the segment indicator indicating which segment of the segment of the indicated page the start of the packet is stored on. In some embodiments, the method further includes: for each of the packets, after storing the end of the packet on one of the segments of the pages in the pages, using buffer logic to retain one or more segments of the adjacent subsequent segments of the page as reserved segments, the reserved segments being capable of storing data from the packet only when the size of the data of the packet increases. In some embodiments, the method further includes, in determining whether the one of the pages is not substantially occupied, utilizing buffer logic to consider the reserved segment as occupied such that the reserved segment is not part of the unoccupied remainder. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 A packet processing system on a packet processing device according to some embodiments is illustrated.

[0012] Figure 2 A buffer manager according to some embodiments is illustrated.

[0013] FIG. 3 illustrates exemplary pages and page state data according to some embodiments.

[0014] Figure 4 An exemplary page descriptor is illustrated in accordance with some embodiments.

[0015] Figure 5 Illustrated are exemplary page state data and descriptor values ​​for two received packets in accordance with some embodiments.

[0016] Figure 6 A method of optimizing packet memory space of a packet processing system according to some embodiments is illustrated. DETAILED DESCRIPTION

[0017] In the following description, many details are set forth for the purpose of explanation. However, those skilled in the art will recognize that the present invention can be implemented without using these specific details. Therefore, the present invention is not intended to be limited to the embodiments shown, but will conform to the widest scope consistent with the principles and features described herein.

[0018] An embodiment is directed to a buffer logic unit of a packet processing device, which is configured to allocate a single page to two or more packets if the current packet stored on the page does not completely fill the page. As a result, the buffer logic unit can reduce the amount of wasted packet memory space by reducing the amount of unused space on each page in the page. Further, the system provides the following advantages by automatically implementing a reserved slot after each packet: accounting for packet data expansion during processing. In addition, the system provides the following advantages: storing and updating segment-specific page status data so that packet data from different packets can be distinguished on the same page. Finally, the system provides the following advantages: setting and updating a reference count value for each page to ensure that the page is not reclaimed before it can be fully allocated to avoid wasting unused space (e.g., segments).

[0019] Figure 1 The diagram illustrates a packet processing system 100 on a packet processing device 99 according to some embodiments. Figure 1As shown in , the packet processing system 100 includes a packet memory 102, a buffer memory 104, a read page client 108, and a write page client 110, all of which are operably coupled together via a network. The packet processing device 99 can be a packet processing circuit and / or a microchip. For example, the device 99 can be a switch microchip (e.g., the top of a rack switch) for a data center, or other types of packet processing circuits or application-specific integrated circuits. In some embodiments, the device 99 is a software-defined network programmable microchip that can be programmed or customized to adjust the way in which the packet is processed. Alternatively, the device 99 can be other types of packet processing devices known in the art. The packet memory 102 includes a plurality of non-transient computer-readable physical memory cells, each having one or more read ports and one or more write ports. When the packet data of an incoming packet is stored on the packet memory 102, it is stored on one or more pages, which are mapped to one or more memory cells in the memory cells of the packet memory 102. As a result, when the packet data is stored in a page rather than all sequentially in the same location in the packet memory 102, the packet data is distributed across multiple physical memory cells of the packet memory to which the page is mapped. In some embodiments, the packet memory 102 includes a content addressable memory (CAM). Alternatively, the packet memory 102 can include a CAM, a ternary content addressable memory (TCAM), a random access memory (RAM), a static random access memory (SRAM), other types of memory known in the art, or a combination thereof.

[0020] Figure 2 Buffer manager 104 is illustrated in accordance with some embodiments. Figure 2 , the buffer manager 104 includes buffer logic 202, a plurality of buffer memory cells 204, one or more page status tables 206, one or more page buffers 208 having one or more pages 212, and one or more page counters 210. Alternatively, the page counters 210 can be omitted. The buffer logic 202 implements the actions of the buffer manager 104, including allocating pages 212 to write clients 110 and reclaiming pages 212 from read clients 108, and implementing corresponding management / updates of the status tables 206, page buffers 208, and page counters 210. The buffer logic 202 can include hardware, software, or a combination of hardware and software configured to perform the functions of the buffer manager 104 described herein, wherein the software is stored on a non-transitory computer-readable medium (e.g., a buffer memory) of the device 99.

[0021] Each of the page buffers 208 stores a subset of pages 212 (or representations thereof) when they are unallocated. When a page needs to be allocated to store packet data of an incoming packet due to a request by a write page client 110, the buffer manager 104, via the buffer logic 202, selects one of the pages 212 from one of the buffers 208 (because they are an unallocated page 212), removes it from the buffer 208 and allocates the page 212 to the write page client 110 for storing at least a portion of the packet data of the incoming packet. Figure 3A As shown in , each of the pages 212 includes a plurality of segments 302 (e.g., segment 0-segment n), each of which constitutes a portion of the page 212. If, after storing the packet data of the incoming packet on the page 212, not all of the segments 302 have been at least partially filled, the buffer manager 104 can determine that the page 212 is not sufficiently full. Therefore, the buffer manager 104 can allocate the remaining portion of the page 212 (including one or more of the unused segments 302 of the page 212) to the packet data of the subsequent incoming packet, and repeat this pattern until the page 212 is determined to be sufficiently full. Later, when all read page clients 108 that need to read the packet data of one or more packets stored on the page indicate that the data stored on the page 212 is no longer needed and the page is ready to be reclaimed, the buffer manager 104 adds the page 212 back to the same page buffer 208. Thus, the page buffer 208 can dynamically indicate to the buffer manager 104 all currently unallocated pages (or portions thereof) that can be selected whenever a page is needed. In this manner, pages 212 can be continuously allocated and reclaimed as packet data is input, stored, processed, and output from the device 99 by the buffer manager 104 in cooperation with the write and read clients 108, 110.

[0022] Each of the buffer memory cells 204 is a non-transitory computer-readable physical memory having one or more read ports and one or more write ports (not shown). As a result, each of the buffer memory cells 204 is capable of independently having data written to and / or read from them in each cycle. Each of the page status tables 206 is stored on one or more of the buffer memory cells 204 and includes a plurality of entries for storing page status data 304 for each of the pages 212 as they are assigned to the packet data of the packet. Figure 3B, the status data for each of the pages 212 can include a page identifier 314, a reference count value 316, and a next page identifier 306. Further, for each of the segments 302 of the associated page 212, the status data 302 can include a used data count 308, a packet start indicator 310, and a packet end indicator 312. The page identifier 314 uniquely identifies the page 212 associated with the page status data 304 so as to correlate the page 212 with the stored status data 304. The reference count value 316 indicates when a previously allocated page 212 is no longer in use and can therefore be reclaimed. Specifically, after a page 212 has been fully allocated by the buffer manager 104, the reference count value 316 indicates the number of packets with different packet data stored on the page 212, so that when the reference count value 316 is zero, the buffer manager 104 can recycle the page 212 back into the associated buffer 208. For example, if the packet data of the first packet is stored on the first two segments 302 of the page 212, and the packet data of the second packet is stored on the remainder of the segments 302 of the page 212, then the reference count value 316 for the page 212 will be equal to two (one for each packet). Therefore, only when both packets are no longer using the page 212 will the value 306 be decremented twice to zero and the page 212 read for recycling.

[0023] The next page identifier 306 indicates the next page (if any) that stores at least a portion of the remaining packet data that does not completely fit into the packet on the current page. In other words, if the last segment 302 of the page 212 is filled, but the packet that fills the last segment 302 still has remaining packet data to be stored, the next page identifier 306 indicates the next page 212 in which the remaining packet data of the packet is at least partially stored. Therefore, the sequence of next page identifiers 306 can match the linked list of pages 212 corresponding to large packets. In some embodiments, the next page identifier 306 can be the same value as the page identifier 314 that the next page identifier 306 is identifying. Alternatively, different identification values ​​can be used. The data count used 308 indicates how much of the segment 302 is occupied by packet data. In some embodiments, the data count used 308 can be the number of bytes currently stored on the segment 302 of the page 212. Alternatively, the data count 308 used can be other units (e.g., kilobytes) or values ​​(e.g., percentages, numbers) that indicate how much of the segment 302 is occupied by packet data. The packet start indicator 310 indicates whether the packet data of the packet begins within the segment 302 of the page 212. Similarly, the packet end indicator 312 indicates whether the packet data of the packet ends within the segment 302 of the page 212. Therefore, the segment-specific status data 308, 310, 312 together indicate which segments and how much of each segment in the segment 302 of the page 212 are occupied by the packet data of the packet, so that packet data from different packets on the same page 212 can be distinguished. In some embodiments, the page status data 304 can also include errors caused in the packet data and / or other types of packet / page data known in the art. In some embodiments, the buffer manager 104 includes a separate status table 206 for each page buffer in the page buffer 208, so that each table 206 is paired with a different one of the buffers 208.

[0024] In operation, each time the write page client 110 receives an incoming packet, it requests a page 212 from the buffer manager 104 to store the packet data for the packet. In response to the request, the buffer manager 104 selects a page 212 from one of the buffers 208 and allocates it to the write page client 110 for the packet data for the packet. Upon receiving the allocated page 212, the write page client 110 writes the packet data on the allocated page 212 of the packet memory 102 and writes the page status data 302 to the corresponding status table 206 for storage using the buffer manager 104 (based on the allocated page 212 and the packet). If the packet data is the first packet data allocated to the page 212 (since the page 212 was last reclaimed), and the buffer manager 104 determines that the page 212 is not sufficiently full after storing the packet data for this first packet, the buffer manager 104 sets the reference count 316 of the status data 304 for the page 212 to an integer greater than one. For example, the buffer manager 104 sets the reference count 316 to two. Specifically, because the page 212 is determined to be not sufficiently full, the buffer manager 104 knows that it will need to further allocate one or more of the unused segments 302 of the page 212 to one or more subsequent packets until the page 212 is sufficiently full. Therefore, in anticipation of packet data from at least one subsequent packet being stored on the page 212 such that total packet data from at least two different packets is stored on the page 212, the buffer manager 104 is able to set the reference count 316 to a number greater than one. This "anticipatory" incrementing of the reference count value 306 provides the benefit of helping to ensure that the page 212 is not reclaimed before all of the stored packet data has been retrieved (e.g., in the case where a first packet is processed before the remainder of the page 212 has been assigned to a subsequent packet). However, if this is the first grouped data allocated to page 212 (since page 212 was last reclaimed), but the buffer manager 104 determines that page 212 is sufficiently full after storing this group of grouped data, the buffer manager 104 sets the reference count 316 of the status data 304 of the first page 212 to one, since no further grouped data will be stored on page 212.

[0025] Additionally, if the packet data is not the first packet data assigned to page 212 (since page 212 was last reclaimed), and the buffer manager 104 determines that page 212 is not sufficiently full after storing the packet data of this subsequent packet, the buffer manager 104 increments the reference count 316 of the status data 304 of page 212 by one (e.g., from 2 to 3). Specifically, the buffer manager 104 has ensured that page 212 is not reclaimed when the reference count 316 for the first packet is incremented, so only incrementing by one is necessary for subsequent packets that still do not sufficiently fill page 212. Finally, if the packet data is not the first packet data assigned to page 212 (since page 212 was last reclaimed), but the buffer manager 104 determines that page 212 is sufficiently full after storing the packet data of this packet, the buffer manager 104 does not change the reference count 316 of the status data 304 of the first page 212. This is because this packet data will be the last packet data stored on page 212, which, as described above, is already accounted for in reference count value 306 when reference count value 306 is incremented to an integer greater than one when the first packet data is allocated page 212. Thus, system 100 provides the benefit of enabling each page 212 to store packet data from multiple packets, thereby increasing the efficiency of packet data storage in packet memory 102. Additionally, system 100 provides the benefit of ensuring that page 212 is not reclaimed before it has been sufficiently filled, which would otherwise result in errors within system 100 and possible packet data loss.

[0026] In some embodiments, if a predetermined number (e.g., one) of segments 302 of a page 212 are not used after storing packet data, the buffer manager 104 determines that the page 212 is not sufficiently filled. Thus, after one or more segments 302 are allocated to the packet data of each packet, if the predetermined number of segments 302 are still not being used, the buffer manager 104 determines that the page 212 is not sufficiently filled and allocates one or more of the remaining unused segments 302 to subsequent packets. Further, in some embodiments, when determining whether a segment 302 is used for the purpose of determining whether a page 212 is sufficiently filled, the buffer manager 104 can consider the predetermined number of segments 302 after the segment 302 storing the end of the last packet data stored on the page 212 as being used. Specifically, because packet data sometimes becomes larger during processing within the device 99, the predetermined number of segments 302 after the segment 302 storing the end of each packet can be reserved if the packet data needs to be expanded into these reserved segments 302 after processing. Therefore, when determining whether the page 212 is sufficiently filled, the buffer manager 104 considers the reserved segments 302 to be full or used, and if the page 212 is still not sufficiently filled, the reserved segments 302 are not allocated to the packet data from the next packet. As a result, the system 100 can advantageously provide a buffer within the memory 102 in the form of reserved segments 302 that enable the packet data to expand without overwriting any subsequent packet data.

[0027] For each packet in the group, the buffer manager 104 also generates Figure 4. The page descriptor 400 includes a packet identifier 402, a page identifier 404, and a segment identifier 406. The packet identifier 402 identifies the packet, the page identifier 404 identifies the page 212 at which the packet is stored, and the segment identifier 406 identifies the segment 302 at which the packet data of the packet is stored (e.g., as indicated by the start of the packet indicator 312) of the identified page 212. This page descriptor 400 can be sent to the processing engine of the device 99 and / or the read page client 108 for use in processing and / or reading out the packet data from the packet memory 102 as needed. In some embodiments, the page identifier 404 can be the same as the page identifier 314 of the status data 304. Alternatively, different identifiers can be used. At the same time, when the read page client 108 is ready to output outgoing packets, they read the page status data 302 associated with these outgoing packets, as indicated by the descriptor 400 of the packet, which is stored on the buffer manager 104. Based on this page status data 302, the read page client 108 is able to locate and read some or all of the packet data of the page or pages 212 of the packet memory 102 where the packet data is stored. As a result, the read page client 108 is then able to output the packet data of the outgoing packet. Each time the read page client 108 indicates that the packet data stored on the page has been read so that it no longer needs to be stored for the packet, the buffer manager 104 decrements the reference count value 316 for the page 212 within the buffer memory. As a result, when the reference count value 316 reaches zero, the buffer manager 104 is able to recycle the page 212 back into the associated page buffer 208 as a currently unused page that can be reallocated when needed.

[0028] Additionally, it should be noted that when one or more packets have a portion of matching packet data stored on page 212, the reference count value 316 for page 212 can also be incremented. For example, this can occur for multicast or broadcast packets, where instead of storing the matching portion of the packet data twice, the reference count value 316 can be incremented by the buffer manager 104 so that page 212 is not recycled until all packets with matching data and any other data on page 212 have been processed and the data is no longer needed. Further, it should be noted that when the state of a page 212 storing packet data from a plurality of packets is written for a subsequent packet of the plurality of packets, the values ​​of the used data count 308, the packet start indicator 310, and / or the packet end indicator 312 for a previous segment occupied by packet data of a previous packet of the plurality of packets need not be partially written. This is because all writes of this page state data 302 within table 206 are performed by the same source (e.g., write page client 110) so that subsequent writes can contain the same values ​​written in the previous write including any additional content for the new packet data. Therefore, the system 100 does not require multiple accesses (read-modify-write) types, but a single write access to the port of the buffer memory unit 204 storing the associated state table 206. In other words, the system 100 does not require additional reads of the state table.

[0029] Figure 5 FIG. 4 illustrates exemplary page state data and descriptor values ​​for two received packets according to some embodiments. Figure 5As shown in , packet A is first received and stored in the first segment 0 of page P, and the next two segments 302 are reserved segments for possible packet data growth. As a result, the descriptor for packet A has a page identifier 404 pointing to page P, and a page segment value pointing to segment 0 at the beginning of the packet data stored with packet A. Further, within the status data 304 of page P, the used data count of segment 0 is set to 60 bytes, and segments 1 and 2 are set to 0 bytes to reflect how much of segments 0, 1, and 2 are filled with packet A, and the packet start indicator and packet end indicator of segment 0 are both set to 1 to indicate that packet A begins and ends in segment 0 of page P. Then, because segment 3 is not used by packet A, the buffer manager 104 is able to determine that page P is not sufficiently filled and sets the reference count value 316 to an integer greater than one (e.g., two) to reflect the need for further packet data to be stored on page P. Then, when packet B requests page 212, the buffer manager 104 can begin by allocating the unused segment 3 of page P to packet B. As a result, the descriptor for packet B has a page identifier 404 pointing to page P, and a page segment value pointing to segment 3 where the packet data for packet B is stored. Further, within the status data 304 for page P, the used data count for segment 3 is set to 64 bytes to reflect how much of segment 3 is filled by packet B, and the packet start indicator for segment 3 is set to 1 to indicate that packet B begins in segment 3 of page P. Page P can then be determined to be sufficiently full that the buffer manager 104 does not increment the reference count value 316 for page P (because no more packet data can be stored on page P). In addition, because more packet data for packet B still needs to be stored, the buffer manager 104 can allocate a new page Q to store more data for packet B, and simultaneously set the next page identifier 306 for page P to identify page Q as the selected next page 212. Then, similar to page P, the remainder of the packet data of packet B is stored in page Q, the associated page state data 304 is added to the page Q entry within the associated state table 206, and the reference count value 316 is simply incremented to 1 to reflect that page Q (including the reserved segment) is fully filled with the remaining packet data of packet B. Thus, the system 100 is able to both utilize the reserved segment to take care of packet data expansion and allocate a single page to different / non-matching packet data from multiple different packets.

[0030] Figure 6 A method of optimizing packet memory space within the packet processing system 100 according to some embodiments is illustrated. Figure 6, at step 602, the buffer manager 104 (via the buffer logic 202) allocates one of the pages 212 to store the packet data of the first group. At step 604, the buffer manager 104 determines whether the page of the page 212 is not fully occupied by the packet data of the first group. In some embodiments, if the unoccupied remaining portion includes at least one of the segments 302 of the page of the page 212, the buffer manager 104 determines that the page of the page 212 is not fully occupied. At step 606, if the page 212 is determined by the buffer manager 104 to be not fully occupied by the packet data, the buffer manager 104 allocates at least a portion of the unoccupied remaining portion (e.g., the segment 302) of the page 212 to store the packet data of one or more additional groups. Therefore, the method provides the following advantages: a single page can be allocated to different packet data of multiple different groups.

[0031] In some embodiments, the method further includes: once the page in pages 212 has been allocated to store the packet data of the first packet, if the page in pages is determined to be underfilled after storing the packet data of the first packet, setting, by the buffer manager 104, a reference count value 316 for the page in pages to an integer greater than one (e.g., two). In some embodiments, the method further includes: for each of the plurality of packets whose packet data is allocated to the page in pages 212, if page 212 is determined to be underfilled after storing the packet data of the packet, incrementing the reference count value 316 for the page in pages 212 by one. In some embodiments, the method further includes: for each of the plurality of packets whose packet data is allocated to the page in pages 212, if page 212 is determined to no longer be underfilled after storing the packet data of the packet, refraining from incrementing the reference count value 316 for the page in pages by one. In some embodiments, the method further includes: storing status data 304 for each of the pages 212 in the buffer memory 204. In some embodiments, the method further includes: generating a descriptor 400 for each of the groups, wherein the descriptor 400 includes a page indicator 404 and a segment indicator 406. In some embodiments, the method further includes: for each group, after storing the end of the group on one of the segments 302 of the page 212, reserving one or more of the adjacent subsequent segments 302 of the page 212 as reserved segments 302, the reserved segments 302 being used to store data from the group if the size of the data of the group increases. In some embodiments, the method further includes: when determining whether the page in the page 212 is not fully occupied, considering the reserved segments 302 as occupied, so that the reserved segments 302 are not part of the unoccupied remainder. Alternatively, in some embodiments, one or more of the above steps can be omitted.

[0032] The packet processing system described herein has many advantages. In particular, the system provides the advantage of optimizing packet memory space by allocating a single page to different / non-matching packet data from multiple different packets, thereby not wasting the unused portion of each page. Further, the system provides the advantage of taking care of packet data expansion during processing by automatically implementing reserved segments after each packet. In addition, the system provides the advantage of storing and updating segment-specific page status data so that packet data from different packets can be distinguished on the same page. Finally, the system provides the advantage of setting and updating a reference count value for each page to ensure that the page is not recycled before it can be fully allocated so as not to waste unused space (e.g., segmentation).

[0033] Although the present invention has been described with reference to many specific details, it will be appreciated by those skilled in the art that without departing from the spirit of the present invention, the present invention can be embodied in other specific forms. For example, although the different methods and operations described herein describe the steps of a specific order, it is also contemplated that other orders, and one or more steps in the omission step and / or one or more new steps are added. In addition, although the above-mentioned methods and operations are described separately herein, one or more methods and operations in the methods and operations can be combined (in whole or in part). Therefore, it will be appreciated by those skilled in the art that the present invention will not be limited by the aforementioned illustrative details, but will be limited by the appended claims.

Claims

1. A packet processing system, the system comprising: a non-transitory computer-readable packet memory divided into a plurality of pages such that each of said pages defines a separate portion of said memory; as well as buffer logic stored at least in part on a non-transitory computer-readable buffer memory, wherein the buffer logic is configured to: allocating a page of the pages to store packet data of a packet of the plurality of packets, wherein the buffer memory includes a reference count value for each of the pages, the reference count value indicating whether the page is in use; If the one of the pages is determined to be underpopulated after storing the packet data of the one of the packets, and the one of the packets is the only one of the packets currently allocated to the one of the pages, adjusting a reference count value of the one of the pages by a first amount; as well as If the one of the pages is determined to be under-occupied after storing the group data of the one group, and the one group is not the only one of the groups currently allocated to the one of the pages, adjust the reference count value of the one of the pages by a second amount, wherein the first amount is an integer greater than 1, and the first amount is greater than the second amount.

2. The system of claim 1 , wherein each of the pages comprises a plurality of segments, and the buffer memory logic determines that the one of the pages is not fully occupied if the unoccupied remainder of the one of the pages comprises at least one segment of the segments of the one of the pages. The system of claim 1 , wherein the first number is two.

4. The system of claim 3 , wherein for each of the plurality of packets whose packet data is allocated to the one of the pages, the buffer logic is configured to increment the reference count value of the one of the pages by one if the one of the pages is determined to be underfilled after storing the packet data of the one of the packets.

5. The system of claim 4 , wherein for each group of the plurality of groups whose group data is allocated to the one of the pages, the buffer logic is configured to avoid incrementing the reference count value of the one of the pages by one if the one of the pages is determined to no longer be underfilled after storing the group data of the one group. 6 . The system of claim 5 , wherein the buffer memory stores status data for each of the pages, wherein the status data for each of the pages comprises a separate status value for each of the segments of the page.

7. The system of claim 6, wherein the status value for each of the segments comprises one or more of the following group, the group comprising: a used data count value indicating how much of the segment is currently storing data; a packet start value indicating whether the start of one of the packets is stored in the segment; and a packet end value indicating whether the end of one of the packets is stored in the segment.

8. The system of claim 7 , wherein the buffer logic is configured to generate a descriptor for each of the packets stored on one or more of the pages, wherein the descriptor comprises a page indicator indicating on which page of the pages the start of the packet is stored, and a segment indicator indicating on which segment of the segments of the indicated page the start of the packet is stored.

9. The system of claim 1 , wherein, for each of the packets, after storing the end of the packet on one of the segments of the page in the page, the buffer logic reserves one or more segments of the adjacent subsequent segments of the page as reserved segments, the reserved segments being capable of storing data from the packet only when the size of the data of the packet increases.

10. The system of claim 9, wherein in determining whether the one of the pages is not substantially occupied, the buffer logic considers the reserved segment as occupied such that the reserved segment is not part of the unoccupied remainder of the one of the pages.

11. A buffer logic unit stored on a non-transitory computer readable buffer memory, wherein the buffer logic is configured to: allocating a page of a plurality of pages to store packet data of a packet of a plurality of packets, wherein the buffer memory includes a reference count value for each of the pages, the reference count value indicating whether the page is in use; If the one of the pages is determined to be underpopulated after storing the packet data of the one of the packets, and the one of the packets is the only one of the packets currently allocated to the one of the pages, adjusting a reference count value of the one of the pages by a first amount; as well as If the one of the pages is determined to be under-occupied after storing the group data of the one group, and the one group is not the only one of the groups currently allocated to the one of the pages, adjust the reference count value of the one of the pages by a second amount, wherein the first amount is an integer greater than 1, and the first amount is greater than the second amount.

12. The buffer logic unit of claim 11 , wherein each of the pages comprises a plurality of segments, and the buffer memory logic determines that the one of the pages is not fully occupied if the unoccupied remainder of the one of the pages comprises at least one segment of the segments of the one of the pages.

13. The buffer logic unit of claim 11, wherein the first number is two.

14. The buffer logic unit of claim 13 , wherein for each group of the plurality of groups whose group data is allocated to the one of the pages, the buffer logic is configured to increment the reference count value of the one of the pages by one if the one of the pages is determined to be not fully occupied after storing the group data of the one group.

15. The buffer logic unit of claim 14, wherein for each group of the plurality of groups whose group data is allocated to the one of the pages, the buffer logic is configured to avoid incrementing the reference count value of the one of the pages by one if the one of the pages is determined to no longer be under-occupied after storing the group data of the one group.

16. The buffer logic unit of claim 15, wherein the buffer memory stores status data for each of the pages, wherein the status data for each of the pages comprises a separate status value for each of the segments of the page.

17. The buffer logic unit of claim 16, wherein the status value for each of the segments comprises one or more of the group consisting of: a used data count value indicating how much of the segment is currently storing data; a packet start value indicating whether the start of one of the packets is stored in the segment; and a packet end value indicating whether the end of one of the packets is stored in the segment.

18. A buffer logic unit according to claim 17, wherein the buffer logic is configured to generate a descriptor for each of the groups stored on one or more of the pages, wherein the descriptor includes a page indicator and a segment indicator, wherein the page indicator indicates on which page of the pages the start of the group is stored, and the segment indicator indicates on which segment of the segments of the indicated page the start of the group is stored.

19. A buffer logic unit according to claim 11, wherein for each of the packets, after storing the end of the packet on one of the segments of the page in the page, the buffer logic reserves one or more segments of the adjacent subsequent segments of the page as reserved segments, and the reserved segments can only store data from the packet when the size of the data of the packet increases.

20. The buffer logic unit of claim 19, wherein in determining whether the one of the pages is not substantially occupied, the buffer logic considers the reserved segment as occupied such that the reserved segment is not part of the unoccupied remainder of the one of the pages.

21. A method of optimizing packet memory space within a packet processing system, the packet processing system comprising a non-transitory computer readable packet memory, the non-transitory computer readable packet memory being logically divided into a plurality of pages, whereby each of the pages defines a separate portion of the memory, the method comprising: allocating one of the pages to store packet data of one of the plurality of packets using buffer logic, wherein the buffer logic is stored at least in part on a non-transitory computer-readable buffer memory; determining, using the buffer logic, whether the one of the pages is not fully occupied by packet data of the one packet, wherein the buffer memory includes a reference count value for each of the pages, the reference count value indicating whether the page is in use; adjusting the reference count value of the one of the pages by a first amount if the one of the pages is determined to be underpopulated after storing the packet data of the one of the packets, and the one of the packets is the only one of the packets currently allocated to the one of the pages; as well as If the one of the pages is determined to be under-occupied after storing the group data of the one group, and the one group is not the only one of the groups currently allocated to the one of the pages, adjust the reference count value of the one of the pages by a second amount, wherein the first amount is an integer greater than 1, and the first amount is greater than the second amount.

22. The method of claim 21 , wherein each of the pages comprises a plurality of segments, and the buffer memory logic determines that the one of the pages is not fully occupied if the unoccupied remainder of the one of the pages comprises at least one segment of the segments of the one of the pages.

23. The method of claim 21, wherein the first number is two.

24. The method according to claim 23, further comprising: For each group of the plurality of groups whose group data is allocated to the one of the pages, if the one of the pages is determined to be under-occupied after storing the group data of the one group, the buffer logic is used to increment the reference count value of the one of the pages by one.

25. The method according to claim 24, further comprising: For each group of the plurality of groups whose group data is allocated to the one of the pages, if the one of the pages is determined to no longer be underfilled after storing the group data of the one group, the buffer logic is used to avoid incrementing the reference count value of the one of the pages by one.

26. The method according to claim 25, further comprising: Status data for each of the pages is stored in the buffer memory using the buffer logic, wherein the status data for each of the pages includes a separate status value for each of the segments of the page.

27. The method of claim 26, wherein the status value for each of the segments comprises one or more of the following group, the group comprising: a used data count value indicating how much of the segment is currently storing data; a packet start value indicating whether the start of one of the packets is stored in the segment; and a packet end value indicating whether the end of one of the packets is stored in the segment.

28. The method of claim 27, further comprising: The buffer logic is used to generate a descriptor for each of the groups stored on one or more of the pages, wherein the descriptor includes a page indicator and a segment indicator, wherein the page indicator indicates on which page of the pages the start of the group is stored, and the segment indicator indicates on which segment of the segments of the indicated page the start of the group is stored.

29. The method of claim 21, further comprising: For each of the groups, after the end of the group is stored on one of the segments of the page in the page, one or more segments of the adjacent subsequent segments of the page are reserved as reserved segments, and the reserved segments can only use the buffer logic to store data from the group when the size of the data of the group increases.

30. The method of claim 29, further comprising: The buffer logic is utilized to consider the reserved segment as occupied when determining whether the one of the pages is not substantially occupied such that the reserved segment is not part of an unoccupied remainder of the one of the pages.

Citation Information

Patent Citations

  • System and method for deadlock-free pipelining

    CN101859257A

  • Combining memory pages having identical content

    CN102708067A