Patent ID: 7738451

Claim:
A method for flexible buffering in a networking system, comprising: allocating a first buffer set having a first number of buffers and a second buffer set having a second number of buffers, wherein each buffer in the first buffer set has a first equal size, each buffer in the second buffer set has a second equal size, the first equal size and the second equal size are different; allocating a first descriptor set and a second descriptor set with first and second descriptors pointing to the buffers in the first and second buffer sets; buffering an input packet into a buffer in one of the first and second buffer sets based on a packet size; counting a first usage rate of the first buffer set and a second usage rate of the second buffer set; re-calculating descriptor amounts in the first and second descriptor sets and the buffer amounts in the first and second buffer sets based on the first and the second usage rates; and re-allocating or releasing the descriptors in the first and second descriptor sets and the buffers in the first and second buffer sets based on the re-calculated descriptor amounts and buffer amounts.