Patent ID: 7161904

Claim:
A method of metering packet flows in a virtual routing engine comprising: performing a first level of metering on packets of a first packet flow using a first metering control block (MCB), the first level of metering being one level of metering in a hierarchy of metering levels; performing a second level of metering on the packets of the first packet flow and packets do second packet flow using a second MCB, the second level of metering being another level of metering in the hierarchy, the first and second MCBs being data structures stored in a shared memory of the virtual routing engine; identifying packets of the first packet how, the first packet flow having the first MCB associated therewith stored in a cache memory; placing a cache-lock on the first MCB prior to performing the first level of metering; placing a cache-lock on the second MCB prior to performing the second level of metering of packets of either the first or second packet flow using the second MCB; releasing the cache-lock on the first MCB after performing the first level of metering on the first packet flow using the first MCB; and releasing the cache-lock on the second MCB after performing the second level of metering on either the first or second packet flows using the second MCB.