Patent ID: 8677075

Claim:
A network processor comprising: a plurality of processing modules coupled to a system cache and at least one shared memory; a memory manager configured to allocate one or more blocks of the shared memory to a requesting one of the plurality of processing modules, wherein the one or more allocated blocks store data corresponding to one or more packets received by the network processor, wherein the memory manager comprises a reference counter configured to maintain, for each allocated memory block, a reference count value indicating a number of access requests of corresponding ones of the plurality of processing modules accessing the memory block; one of the plurality of processing modules, based on a pipeline identifier corresponding to each received packet, is configured to (i) read at least a portion of the data stored in the allocated blocks of the shared memory, (ii) store the read data to one or more corresponding entries of the system cache, (iii) operate on the data stored in the system cache, and (iv) upon completion of operation on the data stored in the system cache, send a request to the memory manager to decrement the reference counter of each of the one or more blocks in the shared memory; wherein, upon receiving the request to decrement the reference counter of each of the one or more blocks in the shared memory, the memory manager is configured to: (i) determine the reference count of the corresponding one or more blocks in the shared memory, and (ii) when the reference counter for a given memory block reaches a predetermined threshold value: (1) determine that the given memory block contains unneeded data; (2) invalidate the one or more entries in the system cache corresponding to the unneeded data, thereby making the one or more entries of the system cache available to store new data and preventing a write operation to write the unneeded data from the system cache to the shared memory; and (3) deallocate the given memory block, thereby making the given memory block available to be reallocated.