Tri-colour data packet counting for tri-colour marking policies
View Patent ↗The invention is directed to counting data packets marked according to tri-color marking techniques. Packets of a packet flow that are marked according to a three color (or tri-color) marking scheme are counted using a counter implemented on a ternary content addressable memory (TCAM). Advantages of some embodiments of the invention are to enable the use of generic and cost-efficient TCAMs to quickly obtain the counts of all three colors of packets in such a packet flow. These counts can be used to provide detailed statistics on characteristics of the packet flow, which can be useful for debugging and accounting purposes.
1. A method of counting packets of a data packet flow marked according to a tri-color marking scheme, comprising the steps of:
receiving a packet of the flow;
determining whether the flow matches a srTCM flow policy;
determining an identifier for the flow;
determining a marked color of the received packet;
incrementing a first counter at a first ternary content-addressable memory (TCAM) entry corresponding to the identifier responsive to the marked color being a first color of said tri-color marking scheme;
incrementing a second counter at the first TCAM entry corresponding to the identifier responsive to the marked color being a second color of said tri-color marking scheme; and
incrementing a third counter at a second TCAM entry corresponding to the identifier.
2. The method of claim 1 , further comprising determining a count of packets from the flow having a marked color being a third color of said tri-color marking scheme by subtracting from a current count of the third counter a sum of current counts of the first and second counters.
3. The method of claim 1 , wherein the first and second colors are green and yellow and the third color is red.
4. The method of claim 1 , wherein the first and second counters are implemented on a first TCAM and the third counter is implemented on a second TCAM.
5. The method of claim 1 , wherein the first, second, and third counters are implemented on respective first, second and third TCAMs.
6. The method of claim 1 , wherein the first, second, and third counters are implemented on a single TCAM.
7. The method of claim 1 , wherein the step of incrementing a third counter comprises incrementing the third counter regardless of the marked color.
8. The method of claim 1 , further comprising
ascertaining if there is a TCAM entry for the identifier;
ascertaining, responsive to there being said TCAM entry, if there are three TCAM counters associated with the entry; and
configuring, responsive to there being fewer than three such TCAM counters, one or more TCAM counters associated with the entry so there are a total of at least three TCAM counters associated with the entry.
9. The method of claim 8 , wherein configuring comprises configuring the one or more counters such that two of the at least three counters are configured on a first TCAM and a third of the at least three counters is configured on a second TCAM.
10. The method of claim 9 wherein configuring said policy in the flow policy storage comprises configuring said policy on either the first or second TCAM.
11. The method of claim 1 , further comprising:
responsive to the flow not matching a srTCM flow policy, configuring said policy in a flow policy storage.