HK1230303B - A packet processing system, method and device to optimize packet buffer space - Google Patents
A packet processing system, method and device to optimize packet buffer spaceInfo
- Publication number
- HK1230303B HK1230303B HK17103792.5A HK17103792A HK1230303B HK 1230303 B HK1230303 B HK 1230303B HK 17103792 A HK17103792 A HK 17103792A HK 1230303 B HK1230303 B HK 1230303B
- Authority
- HK
- Hong Kong
- Prior art keywords
- page
- group
- data
- segment
- packet
- Prior art date
Links
Description
技术领域Technical Field
本发明涉及一种分组处理系统。更特别地,本发明涉及优化分组处理系统中的分组缓冲器空间。The present invention relates to a packet processing system and more particularly to optimizing packet buffer space in a packet processing system.
背景技术Background Art
分组处理设备(如交换机微芯片)经常需要在该设备处理分组时将它们缓冲到具有一个或多个库(bank)的分组存储器(PM)中。用以将分组存储在设备的分组存储器中的当前解决方案是向每个分组指配分组存储器的多个区块(chunk,称为页面),而不是单个大区块。利用这种方案,分组没有连续地被存储在分组存储器的库中,而是被分散在一个或多个页面中,该一个或多个页面一起形成页面的链表,该链表贯穿分组存储器的多个库进行映射。进一步地,多个这些库(和映射到它们的页面)能够逻辑地被归组到(库和相关联的页面的)池中。因此,特定分组在分组缓冲器中使用的所有页面的链表需要被维持在交换机中(在缓冲器管理器或BM中);这一链表在分组从分组缓冲器中被读取出以用于传输时被遍历。每个页面关联了状态,该状态包含与页面有关的一些信息。分组处理器设备中的所有页面的状态被维持在交换机中。分组关联了描述符或标记(token),该描述符或标记除了其他字段之外还包含指向第一页面的指针。利用这一起始指针,通过对利用不同页面状态的下一页面指针所构建的链表进行遍历,由分组所使用的所有页面能够按照它们被用来存储传入分组的相同顺序被取回。作为结果,特定分组使用的所有页面(并且因此,库)的链表被维持在交换机中,并且然后被遍历以从分组存储器定位和读取出分组来用于传输。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. A current solution for storing packets in the device's packet memory is to assign multiple chunks (called pages) of packet memory to each packet, rather than a single large chunk. With this approach, packets are not stored contiguously in the packet memory's banks, but rather are spread across one or more pages, which together form a linked list of pages that are mapped across the multiple banks of the packet memory. Furthermore, multiple 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 a packet buffer by a particular packet needs to be maintained in the switch (in the buffer manager or BM); this linked list is traversed as packets are read from the packet buffer for transmission. Each page is associated with a state that contains some information about the page. The state of all pages in the packet processing device is maintained in the switch. A 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 for 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 can then be traversed to locate and read packets from the packet memory for transmission.
在这些基于页面的分组处理设备中,被浪费的分组存储器与缓冲器管理器上所施加的带宽需求之间存在折中。页面中的每个页面的大小越大,用以读取和写入分组数据所需要的访问就越少,并且因此缓冲器管理器的带宽上的压力越小。然而,页面的大小越大意味着分组存储器的更大的部分可能被浪费或者未使用,因为没有填满整个页面的分组将导致该页面的剩余部分未使用。另一方面,页面大小越小,平均被浪费或未使用的分组存储器就越少,但是归因于用以读取每个分组和将每个分组写入较小页面所要求的访问的数目上的增加,应用到缓冲器管理器的压力更大。In these page-based packet processing devices, there is a trade-off 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 is placed on the buffer manager's bandwidth. However, larger page sizes mean that a larger portion of the packet memory may be wasted or unused, as packets that do not fill an entire page will leave the remainder of the page unused. On the other hand, smaller page sizes mean that on average less packet memory is wasted or unused, but greater pressure is placed on the buffer manager due to the increased number of accesses required to read and write each packet to the smaller page.
另外,在一些分组处理设备中,如果两个或更多分组的一部分具有分组数据的匹配(matching)部分(例如,头部部分或者主体部分),则这些分组能够共享存储有分组数据的匹配部分的一个页面或多个页面,从而匹配数据没有在不同的位置(例如,不同的页面)被存储两次。为了保持跟踪需要使用页面的分组的数目,缓冲器管理器维持用于页面中的每个页面的参考计数值,其指示共享该页面并且还没有从该页面读取出分组数据的页面的数目。例如,在设备确定更多分组需要使用页面时(例如,更多分组具有与该页面上所存储的数据的部分相匹配的部分),该设备能够使参考计数值递增以说明(account for)需要使用该页面的所添加分组。类似地,在数据从这些页面被读取以用于分组中的一个或多个分组时(从而该页面不再需要被使用用于这些分组),该设备能够使参考计数值递减以说明需要使用该页面的分组的较少数量。因此,当参考计数被减少到零时,该设备能够回收该页面用于与其他数据一起重新使用,因为不再有分组需要使用该页面上存储的数据。Additionally, in some packet processing devices, if two or more packets have portions of matching packet data (e.g., header or body portions), the packets can share one or more pages storing the matching portions of the packet data, so that the matching data is not stored twice in different locations (e.g., different pages). To keep track of the number of packets that need to use a page, the buffer manager maintains a reference count value for each of the pages, indicating 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 portions that match the portion of data stored on the page), the device can increment the reference count value to account for the additional packets that need to use the page. Similarly, when data is read from the pages for one or more of the packets (so that the page is no longer needed 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. Thus, 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
一种分组处理设备的缓冲器逻辑单元被配置为,如果页面上所存储的当前分组没有完全填满页面,则将单个的页面分配给两个或更多分组。作为结果,该缓冲器逻辑单元能够通过减少页面中的每个页面上的未使用空间的量,来减少被浪费的分组存储器空间的量。A buffer logic unit of a packet processing device is configured to allocate a single page to two or more packets if a 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.
第一方面针对一种在分组处理设备上的分组处理系统。该系统包括:包括多个物理存储器单元的非瞬态计算机可读分组存储器,该多个物理存储器单元逻辑地被划分为多个页面,从而页面中的每个页面定义物理存储器单元的分离部分;以及至少部分地被存储在非瞬态计算机可读缓冲器存储器上的缓冲器逻辑,其中该缓冲器逻辑被配置为:分配页面中的一个页面来存储多个分组中的第一分组的分组数据;以及如果页面中的该页面被确定为未充分被第一分组的分组数据占用,则分配页面中的该页面的未占用的剩余部分的至少一分部分来存储该多个分组中的一个或多个另外分组的分组数据,以使得页面中的该页面被分配给该多个分组中的两个或更多分组。在一些实施例中,页面中的每个页面包括多个分段,并且如果未占用的剩余部分包括页面中的该页面的分段中的至少一个分段,则缓冲器存储器逻辑确定页面中的该页面未充分被占用。在一些实施例中,缓冲器存储器包括用于页面中的每个页面的参考计数值,该参考计数值指示该多个分组中的多少分组使用该页面,并且另外其中缓冲器逻辑被配置为,一旦页面中的该页面已经被分配来存储第一分组的分组数据,如果页面中的该页面在存储第一分组的分组数据之后被确定为未充分被占用,就将页面中的该页面的参考计数值设置为大于一的整数。在一些实施例中,大于一的该整数是二。在一些实施例中,针对该多个分组中的其分组数据被分配给页面中的该页面的每个分组,缓冲器逻辑被配置为,如果页面中的该页面在存储该分组的分组数据之后被确定为未充分被占用,则使页面中的该页面的参考计数值递增一。在一些实施例中,针对该多个分组中的其分组数据被分配给页面中的该页面的每个分组,缓冲器逻辑被配置为,如果页面中的该页面在存储该分组的分组数据之后被确定为不再是未充分被占用,则避免使页面中的该页面的参考计数值递增一。在一些实施例中,缓冲器存储器存储用于页面中的每个页面的状态数据,其中页面中的每个页面的状态数据包括用于该页面的分段中的每个分段的单独状态值。在一些实施例中,用于分段中的每个分段的状态值包括如下组中的一项或多项,该组包括:所使用数据计数值,指示该分段的多少当前正存储有数据;分组起始值,指示分组中的一个分组的起始是否被存储在该分段中;以及分组末尾值,指示分组中的一个分组的末尾是否被存储在该分段中。在一些实施例中,缓冲器逻辑被配置为生成用于页面中的一个或多个页面上所存储的分组中的每个分组的描述符,其中描述符包括页面指示符和分段指示符,页面指示符指示该分组的起始被存储在页面中的哪个页面上,分段指示符指示该分组的起始被存储在所指示的页面的分段中的哪个分段上。在一些实施例中,针对分组中的每个分组,在将分组的末尾(例如,头部的末尾或者整个分组的末尾)存储在这些页面中的页面的分段中的一个分段上之后,缓冲器逻辑保留页面的邻近后续分段中的一个或多个分段作为保留分段,保留分段仅能够在该分组的数据的大小增加时存储来自该分组的数据。在一些实施例中,在确定页面中的该页面是否未充分被占用时,缓冲器逻辑将保留分段考虑为被占用,以使得保留分段不是未占用的剩余部分的一部分。A first aspect is directed to a packet processing system on a packet processing device. The system includes: a 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; and buffer logic stored at least in part on a non-transitory computer-readable buffer memory, wherein the buffer logic is configured to: allocate one of the pages to store packet data for a first packet of a plurality of packets; and if the page of the pages is determined to be underfilled with packet data for the first packet, allocate at least a portion of an unoccupied remainder of the page of the pages to store packet data for one or more additional packets of the plurality of packets, such that the page of the pages is allocated to two or more packets of the plurality of packets. In some embodiments, each of the pages includes a plurality of segments, and the buffer memory logic determines that the page of the pages is underfilled if the unoccupied remainder includes at least one of the segments of the page of the pages. 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 underpopulated 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 underpopulated 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 refrain from 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 underpopulated 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: 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 page the start of the packet is stored, and a segment indicator indicating on which segment of the segment of the indicated page 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 page in the pages, 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 as the size of the data of the packet increases. In some embodiments, when determining whether the page in the pages is not substantially occupied, the buffer logic considers the reserved segments as occupied such that the reserved segments are not part of the unoccupied remainder.
第二方面针对一种被存储在非瞬态计算机可读缓冲器存储器上的缓冲器逻辑单元,其中该缓冲器逻辑被配置为:分配多个页面中的一个页面来存储多个分组中的第一分组的分组数据;以及如果页面中的该页面被确定为未充分被第一分组的分组数据占用,则分配页面中的该页面的未占用的剩余部分的至少一分部分来存储该多个分组中的一个或多个另外分组的分组数据,以使得页面中的该页面被分配给该多个分组中的两个或更多分组,其中该多个页面中的每个页面包括多个分段并且定义多个物理存储器单元的分离部分。在一些实施例中,页面中的每个页面包括多个分段,并且如果未占用的剩余部分包括页面中的该页面的分段中的至少一个分段,则缓冲器存储器逻辑确定页面中的该页面未充分被占用。在一些实施例中,缓冲器存储器包括用于页面中的每个页面的参考计数值,该参考计数值指示该多个分组中的多少分组使用该页面,并且另外其中缓冲器逻辑被配置为,一旦页面中的该页面已经被分配来存储第一分组的分组数据,如果页面中的该页面在存储第一分组的分组数据之后被确定为未充分被占用,就将页面中的该页面的参考计数值设置为大于一的整数。在一些实施例中,大于一的该整数是二。在一些实施例中,针对该多个分组中的其分组数据被分配给页面中的该页面的每个分组,缓冲器逻辑被配置为,如果页面中的该页面在存储该分组的分组数据之后被确定为未充分被占用,则使页面中的该页面的参考计数值递增一。在一些实施例中,针对该多个分组中的其分组数据被分配给页面中的该页面的每个分组,缓冲器逻辑被配置为,如果页面中的该页面在存储该分组的分组数据之后被确定为不再是未充分被占用,则避免使页面中的该页面的参考计数值递增一。在一些实施例中,缓冲器存储器存储用于页面中的每个页面的状态数据,其中页面中的每个页面的状态数据包括用于该页面的分段中的每个分段的单独状态值。在一些实施例中,用于分段中的每个分段的状态值包括如下组中的一项或多项,该组包括:所使用数据计数值,指示该分段的多少当前正存储有数据;分组起始值,指示分组中的一个分组的起始是否被存储在该分段中;以及分组末尾值,指示分组中的一个分组的末尾是否被存储在该分段中。在一些实施例中,缓冲器逻辑被配置为生成用于页面中的一个或多个页面上所存储的分组中的每个分组的描述符,其中描述符包括页面指示符和分段指示符,页面指示符指示该分组的起始被存储在页面中的哪个页面上,分段指示符指示该分组的起始被存储在所指示的页面的分段中的哪个分段上。在一些实施例中,针对分组中的每个分组,在将分组的末尾存储在这些页面中的页面的分段中的一个分段上之后,缓冲器逻辑保留页面的邻近后续分段中的一个或多个分段作为保留分段,保留分段仅能够在该分组的数据的大小增加时存储来自该分组的数据。在一些实施例中,在确定页面中的该页面是否未充分被占用时,缓冲器逻辑将保留分段考虑为被占用,以使得保留分段不是未占用的剩余部分的一部分。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 pages is determined to be underfilled with the packet data of the first group, allocate at least a portion of an unoccupied remainder of the page of the pages to store packet data of one or more additional groups of the plurality of groups, such that the page of the pages is allocated to two or more groups of the plurality of groups, wherein each page 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 the buffer memory logic determines that the page of the pages is underfilled if the unoccupied remainder includes at least one of the segments of the page of the pages. 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 underpopulated 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 underpopulated 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 refrain from 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 underpopulated 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: 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 page the start of the packet is stored, and a segment indicator indicating on which segment of the segment of the indicated page 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 page in the pages, the buffer logic reserves one or more segments of the adjacent subsequent segments of the page as reserved segments, the reserved segments capable of storing data from the packet only as the size of the data of the packet increases. In some embodiments, when determining whether the page in the pages is not substantially occupied, the buffer logic considers the reserved segments as occupied such that the reserved segments are not part of the unoccupied remainder.
第三方面针对一种优化分组处理系统内的分组存储器空间的方法,该分组处理系统包括非瞬态计算机可读分组存储器,该非瞬态计算机可读分组存储器包括多个物理存储器单元,该多个物理存储器单元逻辑地被划分为多个页面,从而页面中的每个页面定义物理存储器单元的分离部分。该方法包括:利用缓冲器逻辑来分配页面中的一个页面以存储多个分组中的第一分组的分组数据,其中该缓冲器逻辑至少部分地被存储在非瞬态计算机可读缓冲器存储器上;利用缓冲器逻辑来确定页面中的该页面是否未充分被第一分组的分组数据占用;以及如果页面中的该页面被缓冲器逻辑确定为未充分被第一分组的分组数据占用,则利用缓冲器逻辑来分配页面中的该页面的未占用的剩余部分的至少一分部分以存储该多个分组中的一个或多个另外分组的分组数据,以使得页面中的该页面被分配给该多个分组中的两个或更多分组。在一些实施例中,页面中的每个页面包括多个分段,并且如果未占用的剩余部分包括页面中的该页面的分段中的至少一个分段,则缓冲器存储器逻辑确定页面中的该页面未充分被占用。在一些实施例中,缓冲器存储器包括用于页面中的每个页面的参考计数值,该参考计数值指示该多个分组中的多少分组使用该页面,并且该方法进一步包括:一旦页面中的该页面已经被分配来存储第一分组的分组数据,如果页面中的该页面在存储第一分组的分组数据之后被确定为未充分被占用,就将页面中的该页面的参考计数值设置为大于一的整数。在一些实施例中,大于一的该整数是二。在一些实施例中,该方法进一步包括:针对该多个分组中的其分组数据被分配给页面中的该页面的每个分组,如果页面中的该页面在存储该分组的分组数据之后被确定为未充分被占用,则利用缓冲器逻辑来使页面中的该页面的参考计数值递增一。在一些实施例中,该方法进一步包括:针对该多个分组中的其分组数据被分配给页面中的该页面的每个分组,如果页面中的该页面在存储该分组的分组数据之后被确定为不再是未充分被占用,则利用缓冲器逻辑来避免使页面中的该页面的参考计数值递增一。在一些实施例中,该方法进一步包括:利用缓冲器逻辑将用于页面中的每个页面的状态数据存储在缓冲器存储器内,其中页面中的每个页面的状态数据包括用于该页面的分段中的每个分段的单独状态值。在一些实施例中,用于分段中的每个分段的状态值包括如下组中的一项或多项,该组包括:所使用数据计数值,指示该分段的多少当前正存储有数据;分组起始值,指示分组中的一个分组的起始是否被存储在该分段中;以及分组末尾值,指示分组中的一个分组的末尾是否被存储在该分段中。在一些实施例中,该方法进一步包括:利用缓冲器逻辑来生成用于页面中的一个或多个页面上所存储的分组中的每个分组的描述符,其中描述符包括页面指示符和分段指示符,页面指示符指示该分组的起始被存储在页面中的哪个页面上,分段指示符指示该分组的起始被存储在所指示的页面的分段中的哪个分段上。在一些实施例中,该方法进一步包括:针对分组中的每个分组,在将分组的末尾存储在这些页面中的页面的分段中的一个分段上之后,利用缓冲器逻辑来保留页面的邻近后续分段中的一个或多个分段作为保留分段,保留分段仅能够在该分组的数据的大小增加时存储来自该分组的数据。在一些实施例中,该方法进一步包括:在确定页面中的该页面是否未充分被占用时,利用缓冲器逻辑来将保留分段考虑为被占用,以使得保留分段不是未占用的剩余部分的一部分。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, such that each of the pages defines a separate portion of the physical memory cells. The method comprises: allocating, using buffer logic, one of the pages to store packet data for a first packet of a plurality of packets, wherein the buffer logic is at least partially stored on the non-transitory computer-readable buffer memory; determining, using the buffer logic, whether the page of the pages is under-occupied by the packet data for the first packet; and, if the page of the pages is determined by the buffer logic to be under-occupied by the packet data for the first packet, allocating, using the buffer logic, at least a portion of an unoccupied remainder of the page of the pages to store packet data for one or more additional packets of the plurality of packets, such that the page of the pages 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 the buffer memory logic determines that the page of the pages is under-occupied if the unoccupied remainder comprises at least one of the segments of the page of the pages. 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 packet data of the first packet, if the page of the pages is determined to be underpopulated after storing the packet data of the first packet, setting the reference count value for 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 underpopulated after storing the packet data of the packet, incrementing the reference count value for 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 be no longer underpopulated after storing the packet data of the packet, avoiding incrementing the reference count value for the page of the pages by one using the buffer logic. In some embodiments, the method further includes: storing, using buffer logic, status data for each of the pages in the buffer memory, 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: 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 on which page of the page the start of the packet is stored, and the segment indicator indicating on which segment of the segment of the indicated page the start of the packet is stored. 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 page in the pages, retaining, using the buffer logic, one or more segments of the adjacent subsequent segments of the page as reserved segments, the reserved segments capable of storing data from the packet only as the size of the data of the packet increases. In some embodiments, the method further includes, when determining whether the page in the pages is not sufficiently occupied, considering, using the buffer logic, the reserved segments as occupied such that the reserved segments are not part of the unoccupied remainder.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
图1图示了根据一些实施例的分组处理设备上的分组处理系统。FIG1 illustrates a packet processing system on a packet processing device according to some embodiments.
图2图示了根据一些实施例的缓冲器管理器。FIG2 illustrates a buffer manager according to some embodiments.
图3图示了根据一些实施例的示例性页面和页面状态数据。FIG3 illustrates exemplary pages and page state data according to some embodiments.
图4图示了根据一些实施例的示例性页面描述符。FIG4 illustrates an exemplary page descriptor according to some embodiments.
图5图示了根据一些实施例的用于两个所接收的分组的示例性页面状态数据和描述符值。FIG5 illustrates exemplary page state data and descriptor values for two received packets in accordance with some embodiments.
图6图示了根据一些实施例的优化分组处理系统的分组存储器空间的方法。FIG6 illustrates a method of optimizing packet memory space of a packet processing system according to some embodiments.
具体实施方式DETAILED DESCRIPTION
在以下描述中,为了解释的目的阐述了许多细节。然而,本领域的技术人员将认识到,本发明能够无需使用这些具体细节而被实行。因此,本发明不意图为被限制于所示出的实施例,而是将符合于与本文所描述的原理和特征相一致的最宽范围。In the following description, numerous details are set forth for purposes of explanation. However, those skilled in the art will recognize that the present invention can be practiced without these specific details. Therefore, the present invention is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features described herein.
实施例针对一种分组处理设备的缓冲器逻辑单元,其被配置为如果页面上存储的当前分组没有完全填满该页面,则将单个的页面分配给两个或更多分组。作为结果,该缓冲器逻辑单元能够通过减少页面中的每个页面上未使用空间的量,来减少被浪费的分组存储器空间的量。进一步地,该系统通过在每个分组之后自动地实施保留的分段(reservedslot)而提供了如下的优点:在处理期间负责(account for)分组数据扩充。此外,该系统提供了如下的优点:存储并更新特定于分段的页面状态数据以使得来自不同分组的分组数据能够在相同页面上被区分。最后,该系统提供了如下的优点:设置并更新用于每个页面的参考计数值以确保该页面在它能够完全被分配之前不被回收以免浪费未使用空间(例如,分段)。Embodiments are directed to a buffer logic unit of a packet processing device that 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 is able to reduce the amount of wasted packet memory space by reducing the amount of unused space on each of the pages. Further, the system provides the advantage of accounting for packet data expansion during processing by automatically implementing reserved slots 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 reclaimed before it can be completely allocated to avoid wasting unused space (e.g., a segment).
图1图示了根据一些实施例的分组处理设备99上的分组处理系统100。如图1中所示出的,分组处理系统100包括分组存储器102、缓冲器存储器104、读取页面客户端108、以及写入页面客户端110,它们都经由网络可操作地耦合在一起。分组处理设备99能够是分组处理电路和/或微芯片。例如,设备99能够是用于数据中心的(例如,机架交换机的顶部的)交换机微芯片、或者其他类型的分组处理电路或专用集成电路。在一些实施例中,设备99是软件定义的网络可编程的微芯片,其能够被编程或者被定制为调整分组被处理的方式。替换地,设备99能够是本领域中已知的其他类型的分组处理设备。分组存储器102包括多个非瞬态计算机可读物理存储器单元,每个都具有一个或多个读取端口和一个或多个写入端口。当传入分组的分组数据被存储在分组存储器102上时,它被存储在一个或多个页面上,该一个或多个页面映射到分组存储器102的存储器单元中的一个或多个存储器单元。作为结果,当分组数据被存储在页面中而不是全部依次地被存储在分组存储器102中的相同位置时,该分组数据跨分组存储器的由该页面所映射到的多个物理存储器单元而被分布。在一些实施例中,分组存储器102包括内容可寻址存储器(CAM)。替换地,分组存储器102能够包括CAM、三态内容可寻址存储器(TCAM)、随机访问存储器(RAM)、静态随机接入存储器(SRAM)、本领域中已知的其他类型的存储器、或者它们的组合。FIG1 illustrates a packet processing system 100 on a packet processing device 99 according to some embodiments. As shown in FIG1 , 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 operably coupled together via a network. Packet processing device 99 can be a packet processing circuit and/or microchip. For example, device 99 can be a switch microchip used in a data center (e.g., a top of rack switch), or other types of packet processing circuits or application-specific integrated circuits. In some embodiments, device 99 is a software-defined network programmable microchip that can be programmed or customized to adjust how packets are processed. Alternatively, device 99 can be other types of packet processing devices known in the art. Packet memory 102 includes a plurality of non-transitory computer-readable physical memory cells, each having one or more read ports and one or more write ports. When packet data of an incoming packet is stored on packet memory 102, it is stored in one or more pages that are mapped to one or more memory cells in the memory cells of packet memory 102. As a result, when packet data is stored in pages rather than all sequentially in the same location in packet memory 102, the packet data is distributed across multiple physical memory cells of the packet memory to which the pages are mapped. In some embodiments, packet memory 102 comprises a content addressable memory (CAM). Alternatively, packet memory 102 can comprise 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.
图2图示了根据一些实施例的缓冲器管理器104。如图2中所示出的,缓冲器管理器104包括缓冲器逻辑202、多个缓冲器存储器单元204、一个或多个页面状态表格206、具有一个或多个页面212的一个或多个页面缓冲器208、以及一个或多个页面计数器210。替换地,页面计数器210能够被省略。缓冲器逻辑202实施缓冲器管理器104的动作,包括向写入客户端110分配页面212以及从读取客户端108回收页面212,以及实施对状态表格206、页面缓冲器208和页面计数器210的对应管理/更新。缓冲器逻辑202能够包括被配置为执行本文所描述的缓冲器管理器104功能的硬件、软件、或者硬件和软件的组合,其中该软件被存储在设备99的非瞬态计算机可读介质(例如,缓冲器存储器)上。FIG2 illustrates the buffer manager 104 according to some embodiments. As shown in FIG2 , 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 buffer manager 104 functions described herein, wherein the software is stored on a non-transitory computer-readable medium (e.g., buffer memory) of the device 99.
页面缓冲器208中的每个页面缓冲器在页面212(或者它们的表示)未被分配时存储这些页面的子集。当由于写入页面客户端110进行请求,页面需要被分配用以存储传入分组的分组数据时,缓冲器管理器104经由缓冲器逻辑202从缓冲器208中的一个缓冲器选择页面212中的一个页面(因为它们是未被分配的页面212),将它从缓冲器208中移除并且将该页面212分配给写入页面客户端110,以用于存储该传入分组的分组数据的至少一部分。如图3A中所示出的,页面212中的每个页面包括多个分段302(例如,分段0-分段n),每个分段构成页面212的一部分。如果在将该传入分组的分组数据存储在页面212上之后,不是所有的分段302都已经至少部分地被填充,则缓冲器管理器104能够确定页面212不是充分地满。因此,缓冲器管理器104能够将页面212的剩余部分(包括页面212的未使用分段302中的一个或多个分段)分配给后续传入分组的分组数据,并且重复这一模式直到页面212被确定为充分填满。稍后,当需要读取该页面上所存储的一个或多个分组的分组数据的所有读取页面客户端108都指示页面212上所存储的数据不再被需要从而该页面准备好被回收时,缓冲器管理器104将页面212添加回到相同的页面缓冲器208中。因此,页面缓冲器208能够向缓冲器管理器104动态地指示每当需要页面时就能够被选择的所有的当前未被分配的页面(或者它们的部分)。以这种方式,当分组数据被缓冲器管理器104与写入和读取客户端108、110协作地进行输入、存储、处理、以及从设备99输出时,页面212能够连续地被分配和回收。Each page buffer in page buffers 208 stores a subset of pages 212 (or representations thereof) when these pages are unallocated. When a page needs to be allocated to store packet data for an incoming packet due to a request by a write page client 110, buffer manager 104, via buffer logic 202, selects one of pages 212 from one of buffers 208 (because it is an unallocated page 212), removes it from buffer 208, and allocates that page 212 to write page client 110 for storing at least a portion of the packet data for the incoming packet. As shown in FIG3A , each of pages 212 includes a plurality of segments 302 (e.g., segment 0-segment n), each of which constitutes a portion of page 212. If, after storing the packet data for the incoming packet on a page 212, not all segments 302 have been at least partially filled, buffer manager 104 can determine that page 212 is not sufficiently full. Thus, the buffer manager 104 can allocate the remaining portion of page 212 (including one or more of the unused segments 302 of page 212) to the packet data of subsequent incoming packets, and repeat this pattern until 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 that page indicate that the data stored on page 212 is no longer needed and that the page is ready to be reclaimed, the buffer manager 104 adds 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 way, 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.
缓冲器存储器单元204每个都是具有一个或多个读取端口和一个或多个写入端口(未示出)的非瞬态计算机可读物理存储器。作为结果,缓冲器存储器单元204每个都能够在每个周期独立地使数据被写入到它们中和/或从它们中被读取出。页面状态表格206每个都被存储在缓冲器存储器单元204中的一个或多个缓冲器存储器单元上并且包括多个条目,该多个条目用于存储页面212中的每个页面在它们被分配给分组的分组数据时的页面状态数据304。如图3B中所示出的,用于页面212中的每个页面的状态数据能够包括页面标识符314、参考计数值316、以及下一页面标识符306。进一步地,对于相关联的页面212的分段302中的每个分段,状态数据302能够包括所使用的数据计数308、分组起始指示符310、以及分组末尾指示符312。页面标识符314唯一地识别与页面状态数据304相关联的页面212,以便将页面212与所存储的状态数据304相关。参考计数值316指示先前分配的页面212何时不再处于使用中并且因此可以被回收。具体地,在页面212已经被缓冲器管理器104完全分配之后,参考计数值316指示具有页面212上所存储的不同分组数据的分组的数目,从而当参考计数值316为零时,缓冲器管理器104能够将页面212回收回到相关联的缓冲器208中。例如,如果第一分组的分组数据被存储在页面212的前两个分段302上,并且第二分组的分组数据被存储在页面212的分段302的剩余部分上,则用于该页面212的参考计数值316将等于二(对于每个分组是一)。因此,仅当这两个分组都不再是正在使用页面212时,值306才将被递减两次而等于零并且页面212被读取以便回收。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 can independently have data written to and/or read from them during 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 packetized data. As shown in FIG. 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 start-of-packet indicator 310, and an end-of-packet indicator 312. Page identifier 314 uniquely identifies page 212 associated with page status data 304, so as to correlate page 212 with the stored status data 304. Reference count value 316 indicates when a previously allocated page 212 is no longer in use and can therefore be reclaimed. Specifically, after page 212 has been fully allocated by buffer manager 104, reference count value 316 indicates the number of packets with different packet data stored on page 212, so that buffer manager 104 can reclaim page 212 back into the associated buffer 208 when reference count value 316 is zero. For example, if packet data for a first packet is stored on the first two segments 302 of page 212, and packet data for a second packet is stored on the remainder of segment 302 of page 212, then reference count value 316 for that page 212 will be equal to two (one for each packet). Therefore, only when both packets are no longer using page 212 will value 306 be decremented twice to zero and page 212 read for reclaiming.
下一页面标识符306指示下一页面(如果有的话),该下一页面存储不完全适合于在当前页面上的分组的剩余分组数据的至少一部分。换句话说,如果页面212的最后分段302被填满,但是将最后分段302填满的分组仍然有剩余分组数据要被存储,则下一页面标识符306指示该分组的剩余分组数据至少部分地被存储在其中的下一页面212。因此,下一页面标识符306的序列能够匹配于与大分组相对应的页面212的链表。在一些实施例中,下一页面标识符306能够是与下一页面标识符306正在识别的页面标识符314相同的值。替换地,能够使用不同的识别值。所使用的数据计数308指示分段302的多少被分组数据占用。在一些实施例中,所使用的数据计数308能够是当前被存储在页面212的分段302上的字节的数目。替换地,所使用的数据计数308能够是指示分段302的多少被分组数据占用的其他单位(例如,千字节)或者值(例如,百分比、数字)。分组起始指示符310指示是否分组的分组数据开始于页面212的该分段302内。类似地,分组末尾指示符312指示是否分组的分组数据结束于页面212的该分段302内。因此,特定于分段的状态数据308、310、312一起指示了页面212的分段302中的哪些分段和每个分段的多少被分组的分组数据占用,从而相同页面212上的来自不同分组的分组数据能够被区分。在一些实施例中,页面状态数据304还能够包括分组数据内所引发的错误和/或本领域中已知的其他类型的分组/页面数据。在一些实施例中,缓冲器管理器104包括用于页面缓冲器208中的每个页面缓冲器的单独的状态表格206,从而每个表格206与缓冲器208中的不同的一个缓冲器成对。Next page identifier 306 indicates the next page (if any) that stores at least a portion of the remaining packet data for the packet that does not fit completely on the current page. In other words, if the last segment 302 of page 212 is full, but the packet that filled the last segment 302 still has remaining packet data to be stored, next page identifier 306 indicates the next page 212 in which the remaining packet data for that packet is at least partially stored. Thus, the sequence of next page identifiers 306 can match the linked list of pages 212 corresponding to the large packet. In some embodiments, next page identifier 306 can be the same value as page identifier 314 that next page identifier 306 is identifying. Alternatively, a different identifying value can be used. Used data count 308 indicates how much of segment 302 is occupied by packet data. In some embodiments, used data count 308 can be the number of bytes currently stored in segment 302 of page 212. Alternatively, the data count 308 used can be another unit (e.g., kilobytes) or value (e.g., a percentage, a number) indicating how much of the segment 302 is occupied by packet data. A start-of-packet indicator 310 indicates whether the packet data of the packet begins within the segment 302 of the page 212. Similarly, an end-of-packet indicator 312 indicates whether the packet data of the packet ends within the segment 302 of the page 212. Thus, the segment-specific status data 308, 310, 312 together indicate which segments of the segments 302 of the page 212 and how much of each segment is occupied by the packet data of the packet, thereby enabling packet data from different packets on the same page 212 to be distinguished. In some embodiments, the page status data 304 can also include errors caused within 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, such that each table 206 is paired with a different one of the buffers 208.
在操作中,每次写入页面客户端110接收到传入分组时,它从缓冲器管理器104请求页面212来存储该分组的分组数据。响应于该请求,缓冲器管理器104从缓冲器208中的一个缓冲器选择页面212并且分配给写入页面客户端110以用于该分组的分组数据。一经接收到所分配的页面212,写入页面客户端110就将分组数据写入在分组存储器102的所分配的页面212上,并且利用缓冲器管理器104(基于所分配的页面212和该分组)将页面状态数据302写入到对应的状态表格206用于存储。如果分组数据是(自从页面212上次被回收以来)分配给页面212的第一分组数据,并且缓冲器管理器104确定页面212在存储这个第一分组的分组数据之后未充分被填满,则缓冲器管理器104将页面212的状态数据304的参考计数316设置为大于一的整数。例如,缓冲器管理器104将参考计数316设置为二。具体地,因为页面212被确定为未充分被填满,所以缓冲器管理器104知道它将需要把页面212的未使用的分段302中的一个或多个分段进一步分配给一个或多个后续分组,直到页面212充分被填满。因此,预期到来自至少一个后续分组的分组数据被存储在页面212上而使得来自至少两个不同分组的总分组数据被存储在页面212上,缓冲器管理器104能够将参考计数316设置为大于一的数字。对参考计数值306的这种“预期的”递增提供了如下的益处:帮助确保页面212在全部所存储的分组数据已经被取回之前(例如,在第一分组在页面212的剩余部分已经被指配给后续分组之前就被处理的情况中)不被回收。然而,如果这是(自从页面212上次被回收以来)分配给页面212的第一分组数据,但是缓冲器管理器104确定页面212在存储这个分组的分组数据之后充分被填满,则缓冲器管理器104将第一页面212的状态数据304的参考计数316设置为一,因为没有进一步的分组数据将被存储在页面212上。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 onto 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, buffer manager 104 sets reference count 316 to two. Specifically, because page 212 is determined to be insufficiently full, buffer manager 104 knows that it will need to further allocate one or more of the unused segments 302 of page 212 to one or more subsequent packets until page 212 is sufficiently full. Thus, in anticipation of packet data from at least one subsequent packet being stored on page 212, such that total packet data from at least two different packets is stored on page 212, buffer manager 104 can set reference count 316 to a number greater than one. This "expected" incrementing of reference count value 306 provides the benefit of helping to ensure that page 212 is not reclaimed before all stored packet data has been retrieved (e.g., in the event that a first packet is processed before the remainder of page 212 has been assigned to a subsequent packet). However, if this is the first packet 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 packet of packet 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 packet data will be stored on page 212.
另外,如果分组数据不是(自从页面212上次被回收以来)分配给页面212的第一分组数据,并且缓冲器管理器104确定页面212在存储这一后续分组的分组数据之后未充分被填满,则缓冲器管理器104使页面212的状态数据304的参考计数316递增一(例如,从2到3)。具体地,缓冲器管理器104已经确保了在使用于第一分组的参考计数316递增时页面212不被回收,因此对于仍然没有充分填满页面212的后续分组而言仅递增一是必要的。最后,如果分组数据不是(自从页面212上次被回收以来)分配给页面212的第一分组数据,但是缓冲器管理器104确定页面212在存储这个分组的分组数据之后充分被填满,则缓冲器管理器104不改变第一页面212的状态数据304的参考计数316。这是因为这个分组数据将是存储在页面212上的最后的分组数据,如上文所描述的,当参考计数值306在第一分组数据被分配了页面212时被递增到大于一的整数时,这已经在参考计数值306中被说明(account for)。因此,系统100提供了如下的益处:使得每个页面212能够存储来自多个分组的分组数据,由此增加了分组存储器102中的分组数据存储的效率。另外,系统100提供了如下的益处:确保页面212在它已经充分被填满之前不被回收,否则将会导致系统100内的错误以及可能的分组数据丢失。Additionally, if the packet data is not the first packet data assigned to page 212 (since page 212 was last reclaimed), and buffer manager 104 determines that page 212 is not sufficiently full after storing the packet data for this subsequent packet, buffer manager 104 increments reference count 316 of state data 304 for page 212 by one (e.g., from 2 to 3). Specifically, buffer manager 104 has already ensured that page 212 is not reclaimed when incrementing reference count 316 for the first packet, so incrementing by one is only 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 buffer manager 104 determines that page 212 is sufficiently full after storing the packet data for this packet, buffer manager 104 does not change reference count 316 of state data 304 for the first page 212. This is because this packet data will be the last packet data stored on page 212, which is 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, as described above. 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 is sufficiently full, which would result in errors within system 100 and possible packet data loss.
在一些实施例中,如果页面212的预定数目的(例如,一个)分段302在存储分组数据之后没有被使用,则缓冲器管理器104确定页面212未充分被填满。因此,在一个或多个分段302被分配给每个分组的分组数据之后,如果该预定数目的分段302仍然没有正在被使用,则缓冲器管理器104确定页面212未充分被填满并且将剩余的未使用的分段302中的一个或多个分段分配给后续分组。进一步地,在一些实施例中,当确定分段302是否被使用用于确定页面212是否充分被填满的目的时,缓冲器管理器104能够把在存储有页面212上所存储的最后分组数据的末尾的分段302之后的预定数目的分段302考虑为被使用。具体地,因为在设备99内的处理期间,分组数据有时变得更大,在存储每个分组的末尾的分段302之后的该预定数目的分段302能够被保留,假如分组数据在处理之后需要扩充到这些保留分段302中的话。因此,当确定页面212是否充分被填满时,缓冲器管理器104将保留分段302考虑为是满的或者被使用,并且如果页面212仍然未充分被填满,则保留分段302不被分配给来自下一分组的分组数据。作为结果,系统100能够有利地以保留分段302的形式来提供存储器102内的缓冲器,这些保留分段302使得分组数据能够扩充而不覆写任何后续分组数据。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 full. 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 full 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 full, 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 grows larger during processing within device 99, the predetermined number of segments 302 after the segment 302 storing the end of each packet can be reserved in case the packet data needs to be expanded into these reserved segments 302 after processing. Thus, when determining whether page 212 is sufficiently full, buffer manager 104 considers the reserved segments 302 to be full or used, and if page 212 is still not sufficiently full, the reserved segments 302 are not allocated for packet data from the next packet. As a result, system 100 can advantageously provide a buffer within memory 102 in the form of reserved segments 302 that allow packet data to be expanded without overwriting any subsequent packet data.
对于分组中的每个分组,缓冲器管理器104还生成如图4中所示出的页面描述符400。页面描述符400包括分组标识符402、页面标识符404、以及分段标识符406。分组标识符402识别分组,页面标识符404识别存储分组的起始的页面212,并且分段标识符406识别所识别页面212的存储有分组的分组数据的起始的分段302(例如,如由分组指示符312的起始所指示)。这一页面描述符400能够被发送给设备99的处理引擎和/或读取页面客户端108以用于按照需要地在处理和/或读取出来自分组存储器102的分组数据时使用。在一些实施例中,页面标识符404能够与状态数据304的页面标识符314是相同的。替换地,能够使用不同的标识符。同时,当读取页面客户端108准备好输出传出分组时,它们读取与这些传出分组相关联的页面状态数据302,如分组的描述符400所指示的,其被存储在缓冲器管理器104上。基于这一页面状态数据302,读取页面客户端108能够定位并且读取来自分组数据被存储的分组存储器102的页面或多个页面212的分组数据中的一些或全部。作为结果,读取页面客户端108然后能够输出传出分组的分组数据。每次读取页面客户端108指示页面上所存储的分组数据已经被读取从而它不再需要被存储用于该分组时,缓冲器管理器104把用于缓冲器存储器内的页面212的参考计数值316递减。作为结果,当参考计数值316达到零时,缓冲器管理器104能够将页面212回收回到相关联的页面缓冲器208中作为在需要时能够被重新分配的当前未使用的页面。For each of the packets, buffer manager 104 also generates a page descriptor 400, as shown in FIG4 . Page descriptor 400 includes a packet identifier 402, a page identifier 404, and a segment identifier 406. Packet identifier 402 identifies the packet, page identifier 404 identifies the starting page 212 storing the packet, and segment identifier 406 identifies the starting segment 302 of the identified page 212 storing the packet's packet data (e.g., as indicated by the start of packet indicator 312). This page descriptor 400 can be sent to a processing engine and/or a read page client 108 of device 99 for use in processing and/or reading packet data from packet memory 102, as needed. In some embodiments, page identifier 404 can be the same as page identifier 314 of state data 304. Alternatively, different identifiers can be used. At the same time, when the read page clients 108 are ready to output outgoing packets, they read the page status data 302 associated with these outgoing packets, as indicated by the packet's descriptor 400, which is stored on the buffer manager 104. Based on this page status data 302, the read page clients 108 are able to locate and read some or all of the packet data from the page or pages 212 of the packet memory 102 where the packet data is stored. As a result, the read page clients 108 are then able to output the packet data for the outgoing packets. Each time the read page client 108 indicates that the packet data stored on a page has been read and therefore no longer needs to be stored for that 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 can reclaim the page 212 back into the associated page buffer 208 as a currently unused page that can be reallocated when needed.
另外,应当注意,当一个或多个分组具有被存储在页面212上的一部分匹配分组数据时,页面212的参考计数值316也能够被递增。例如,这能够针对多播或广播分组而发生,其中替代将分组数据的匹配部分存储两次,参考计数值316能够被缓冲器管理器104增加以使得页面212不被回收,直到具有匹配数据和页面212上的任何其他数据的所有分组已经被处理并且不再需要该数据。进一步地,应当注意,当存储来自多个分组的分组数据的页面212的状态针对该多个分组的后续分组而被写入时,不需要部分地写入对于由该多个分组的先前分组的分组数据占用的先前分段而言的所使用数据计数308、分组起始指示符310、和/或分组末尾指示符312的值。这是因为表格206内的这一页面状态数据302的所有写入都由相同源(例如,写入页面客户端110)来执行,以使得后续写入能够包含先前写入中包括用于新分组数据的任何附加内容而被写入的相同值。因此,系统100不要求对存储相关联的状态表格206的缓冲器存储器单元204的端口的多种访问(读取-修改-写入)类型,而是单个写入访问。换句话说,系统100不要求对状态表格的额外读取。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 buffer manager 104 so that page 212 is not reclaimed 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, it is not necessary to partially write the values of the used data count 308, packet start indicator 310, and/or packet end indicator 312 for the previous segment occupied by packet data of a previous packet of the plurality of packets. This is because all writes to this page state data 302 within table 206 are performed by the same source (e.g., write page client 110), so that the subsequent write can contain the same values written in the previous write, including any additional content for the new packet data. Thus, the system 100 does not require multiple accesses (read-modify-write) types, but rather a single write access to the port of the buffer memory unit 204 storing the associated status table 206. In other words, the system 100 does not require additional reads of the status table.
图5图示了根据一些实施例的用于两个所接收的分组的示例性页面状态数据和描述符值。如图5中所示出的,分组A首先被接收并且存储在页面P的第一分段0中,并且接下来的两个分段302是用于可能的分组数据增长的保留分段。作为结果,用于分组A的描述符具有指向页面P的页面标识符404、以及指向存储有分组A的分组数据的开端的分段0的页面分段值。进一步地,在页面P的状态数据304内,分段0的所使用数据计数被设置为60字节,并且分段1和2被设置为0字节以反映分段0、1和2的多少被分组A填充,并且分段0的分组起始指示符和分组末尾指示符两者都被设置为1以指示分组A开始和结束于页面P的分段0中。然后,因为分段3未被分组A使用,所以缓冲器管理器104能够确定页面P未充分被填满并且将参考计数值316设置为大于一的整数(例如,二)以反映对于将被存储在页面P上的进一步分组数据的需求。然后,当分组B请求页面212时,缓冲器管理器104能够通过将页面P的未使用的分段3分配给分组B来开始。作为结果,用于分组B的描述符具有指向页面P的页面标识符404、以及指向存储有分组B的分组数据的开端的分段3的页面分段值。进一步地,在页面P的状态数据304内,分段3的所使用数据计数被设置为64字节以反映分段3的多少被分组B填充,并且分段3的分组起始指示符被设置为1以指示分组B开始于页面P的分段3中。页面P然后能够被确定为充分被填满,从而缓冲器管理器104不把用于页面P的参考计数值316递增(因为没有更多的分组数据能够被存储在页面P上)。此外,因为分组B的更多分组数据仍然需要被存储,所以缓冲器管理器104能够分配新的页面Q以存储分组B的更多数据,并且同时设置页面P的下一页面标识符306以将页面Q识别为所选择的下一页面212。然后,类似于在页面P中,分组B的分组数据的剩余部分被存储在页面Q中,相关联的页面状态数据304被添加到相关联的状态表格206内的页面Q条目,并且参考计数值316仅被递增到1以反映页面Q(包括保留分段)被分组B的剩余分组数据充分填满。因此,系统100能够既利用保留分段来负责分组数据扩充,并且又将单个的页面分配给来自多个不同分组的不同/非匹配的分组数据。Figure 5 illustrates exemplary page status data and descriptor values for two received packets according to some embodiments. As shown in Figure 5, 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 of segment 0 pointing to the beginning of the packet data stored with packet A. Further, within the status data 304 for page P, the used data count for 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 for 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 can determine that page P is not sufficiently full 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, which is 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, so 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). Furthermore, 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 of page P to identify page Q as the selected next page 212. The remaining portion of the packet data for packet B is then stored in page Q, similar to page P, the associated page status data 304 is added to the page Q entry within the associated status 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 for packet B. Thus, the system 100 can both utilize the reserved segment to account for packet data expansion and allocate a single page to different/non-matching packet data from multiple different packets.
图6图示了根据一些实施例的优化分组处理系统100内的分组存储器空间的方法。如图6中所示出的,在步骤602处,缓冲器管理器104(经由缓冲器逻辑202)分配页面212中的一个页面来存储第一分组的分组数据。在步骤604处,缓冲器管理器104确定页面212中的该页面是否未充分被第一分组的分组数据占用。在一些实施例中,如果未占用的剩余部分包括页面212中的该页面的分段302中的至少一个分段,则缓冲器管理器104确定页面212中的该页面未充分被占用。在步骤606处,如果页面212被缓冲器管理器104确定为未充分被分组数据占用,则缓冲器管理器104分配页面212的未占用的剩余部分(例如,分段302)的至少一部分来存储一个或多个另外分组的分组数据。因此,该方法提供了如下的优点:使得单个页面能够被分配给多个不同分组的不同分组数据。FIG6 illustrates a method for optimizing packet memory space within packet processing system 100 according to some embodiments. As shown in FIG6 , at step 602, buffer manager 104 (via buffer logic 202) allocates one of pages 212 to store packet data for a first packet. At step 604, buffer manager 104 determines whether the page in page 212 is not fully occupied by packet data for the first packet. In some embodiments, buffer manager 104 determines that the page in page 212 is not fully occupied if the unoccupied remaining portion includes at least one of segments 302 of the page in page 212. At step 606, if buffer manager 104 determines that page 212 is not fully occupied by packet data, buffer manager 104 allocates at least a portion of the unoccupied remaining portion (e.g., segment 302) of page 212 to store packet data for one or more additional packets. Thus, this method provides the advantage of enabling a single page to be allocated to different packet data for multiple different packets.
在一些实施例中,该方法进一步包括:一旦页面212中的该页面已经被分配来存储第一分组的分组数据,如果页面中的该页面在存储第一分组的分组数据之后被确定为未充分被占用,就利用缓冲器管理器104将页面中的该页面的参考计数值316设置为大于一的整数(例如,二)。在一些实施例中,该方法进一步包括:针对该多个分组中的其分组数据被分配给页面212中的该页面的每个分组,如果页面212在存储该分组的分组数据之后被确定为未充分被占用,则使页面212中的该页面的参考计数值316递增一。在一些实施例中,该方法进一步包括:针对该多个分组中的其分组数据被分配给页面212中的该页面的每个分组,如果页面212在存储该分组的分组数据之后被确定为不再是未充分被占用,则避免使页面中的该页面的参考计数值316递增一。在一些实施例中,该方法进一步包括:将用于页面212中的每个页面的状态数据304存储在缓冲器存储器204内。在一些实施例中,该方法进一步包括:生成用于分组中的每个分组的描述符400,其中描述符400包括页面指示符404和分段指示符406。在一些实施例中,该方法进一步包括:针对每个分组,在将分组的末尾存储在页面212的分段302中的一个分段上之后,保留页面212的邻近后续分段302中的一个或多个分段作为保留分段302,保留分段302用于如果该分组的数据的大小增加则存储来自该分组的数据。在一些实施例中,该方法进一步包括:在确定页面212中的该页面是否未充分被占用时,将保留分段302考虑为被占用,以使得保留分段302不是未占用的剩余部分的一部分。替换地,在一些实施例中,上述步骤中的一个或多个步骤能够被省略。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, setting, using buffer manager 104, a reference count value 316 for the page in pages to an integer greater than one (e.g., two) if the page in pages is determined to be underpopulated after storing the packet data of the first packet. In some embodiments, the method further includes, for each group in the plurality of groups whose packet data is allocated to the page in pages 212, incrementing the reference count value 316 for the page in pages 212 by one if page 212 is determined to be underpopulated after storing the packet data of the group. In some embodiments, the method further includes, for each group in the plurality of groups whose packet data is allocated to the page in pages 212, refraining from incrementing the reference count value 316 for the page in pages by one if page 212 is determined to no longer be underpopulated after storing the packet data of the group. In some embodiments, the method further includes storing status data 304 for each page in pages 212 within buffer memory 204. In some embodiments, the method further includes generating a descriptor 400 for each of the packets, wherein the descriptor 400 includes a page indicator 404 and a segment indicator 406. In some embodiments, the method further includes, for each packet, after storing the end of the packet in one of the segments 302 of page 212, reserving one or more segments of adjacent subsequent segments 302 of page 212 as reserved segments 302 for storing data from the packet if the size of the data for the packet increases. In some embodiments, the method further includes considering the reserved segments 302 as occupied when determining whether the page in pages 212 is not fully occupied, such 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.
本文所描述的分组处理系统具有许多优点。特别地,该系统提供了如下的优点:通过将单个的页面分配给来自多个不同分组的不同/非匹配的分组数据,由此不浪费每个页面的未使用部分,来优化分组存储器空间。进一步地,该系统提供了如下的优点:通过在每个分组之后自动地实施保留分段,来负责在处理期间的分组数据扩充。此外,该系统提供了如下的优点:存储并更新特定于分段的页面状态数据,从而来自不同分组的分组数据能够在相同页面上被区分。最后,该系统提供了如下的优点:设置并更新用于每个页面的参考计数值,以确保该页面在它能够完全被分配之前不被回收以便不浪费未使用的空间(例如,分段)。The packet processing system described herein has numerous 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 unused portions of each page. Further, the system provides the advantage of accounting for packet data expansion during processing by automatically implementing reserved segments after each packet. Additionally, 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 reclaimed before it can be fully allocated so as not to waste unused space (e.g., segments).
虽然已经参考许多具体细节描述了本发明,但是本领域的技术人员将认识到,不偏离本发明的精神,本发明能够以其他的具体形式来具体化。例如,尽管本文所描述的不同方法和操作描述了特定顺序的步骤,但是也设想到其他顺序、以及省略步骤中的一个或多个步骤和/或添加一个或多个新的步骤。此外,尽管上述方法和操作在本文中分离地被描述,但是方法和操作中的一个或多个方法和操作能够(以整体或部分地)被组合。因此,本领域的技术人员将理解,本发明将不被前述说明性的细节所限制,而是将由所附权利要求来限定。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 particular order, it is also contemplated that other orders, and one or more steps in the step of omitting and/or adding one or more new steps are contemplated. In addition, although the above methods and operations are described separately herein, one or more methods and operations in the method and operation 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 (30)
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| US14/673,813 | 2015-03-30 |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| HK1230303A1 HK1230303A1 (en) | 2017-12-01 |
| HK1230303B true HK1230303B (en) | 2022-07-08 |
Family
ID=
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US11652760B2 (en) | Packet processing system, method and device having reduced static power consumption | |
| CN117033002B (en) | Memory management method, device, equipment and storage medium | |
| US9086950B2 (en) | Method for heap management | |
| EP3077914B1 (en) | System and method for managing and supporting virtual host bus adaptor (vhba) over infiniband (ib) and for supporting efficient buffer usage with a single external memory interface | |
| WO2020199760A1 (en) | Data storage method, memory and server | |
| WO2014023091A1 (en) | Rule matching method and device | |
| US7861056B2 (en) | Methods, systems, and computer program products for providing memory management with constant defragmentation time | |
| US20130061009A1 (en) | High Performance Free Buffer Allocation and Deallocation | |
| CN106294191B (en) | The method for handling table, the method and apparatus for accessing table | |
| CN101848150B (en) | Method and device for maintaining count value of multicast counter | |
| US10003551B2 (en) | Packet memory system, method and device for preventing underrun | |
| US10061513B2 (en) | Packet processing system, method and device utilizing memory sharing | |
| CN104572507B (en) | The method and apparatus that memory for control function component uses | |
| CN115794417A (en) | Memory management method and device | |
| CN106021121B (en) | Packet processing system, method and apparatus for optimizing packet buffer space | |
| US20060153185A1 (en) | Method and apparatus for dynamically changing ring size in network processing | |
| CN104753788A (en) | Data forwarding method and device based on index allocation | |
| HK1230303B (en) | A packet processing system, method and device to optimize packet buffer space | |
| CN105704037A (en) | Table item storage method and controller | |
| US10067690B1 (en) | System and methods for flexible data access containers | |
| HK1230303A1 (en) | A packet processing system, method and device to optimize packet buffer space | |
| US9582215B2 (en) | Packet processing system, method and device utilizing memory sharing | |
| US9612950B2 (en) | Control path subsystem, method and device utilizing memory sharing | |
| CN110764707A (en) | Data processing method and device | |
| WO2014039339A1 (en) | Hardware based memory allocation system with directly connected memory |