Claims
- 1. A method for storing prefixes for a plurality of rules in a computer system, the computer system having a ternary content addressable memory (TCAM), the plurality of rules using at least one range of values in at least one dimension and corresponding to a plurality of prefixes, the at least one range being described by at least one prefix, a portion of the plurality of rules capable of intersecting, the method comprising the steps of:
(a) providing a plurality of priorities for the plurality of rules, the plurality of priorities including at least one different priority for the portion of the plurality of rules that intersect; and (b) storing the plurality of prefixes in the TCAM in at least one block in an order based upon the plurality of priorities of the plurality of rules.
- 2. The method of claim 1 wherein the plurality of rules are a plurality of filter rules.
- 3. The method of claim 1 wherein the computer system further includes an additional storage and wherein the plurality of rules are further capable of including at least one rule capable of having an almost exact match, the method further comprising the step of:
(c) separately storing in the additional storage at least one corresponding prefix for the at least one rule having the almost exact match, the additional storage capable of being searched independently from the TCAM.
- 4. The method of claim 1 wherein the storing step (b) further includes the step of:
(b1) storing the plurality of prefixes such that a portion of the plurality of rules having identical priorities are stored in a single block.
- 5. The method of claim 4 wherein the storing step (b1) further includes the steps of:
(b1i) moving a first entry for each subsequent block to an end of the subsequent block; and (b1ii) inserting a higher priority entry in a previous block.
- 6. A method for searching prefixes for a plurality of rules in a computer system for a match for a key, the computer system having a ternary content addressable memory (TCAM) and an additional storage, the plurality of rules using at least one range of values in at least one dimension and corresponding to a plurality of prefixes, the at least one range being described by at least one prefix, a portion of the plurality of rules capable of intersecting, a plurality of priorities corresponding to the plurality of rules, the plurality of priorities including at least one different priority for the portion of the plurality of rules that intersect, the plurality of prefixes being stored in the TCAM in an order based upon the plurality of priorities of the plurality of rules, the plurality of rules are further capable of including at least one rule capable of having an almost exact match, the additional storage storing at least one corresponding prefix for the at least one rule having the almost exact match, the additional storage capable of being searched independently from the TCAM, the method comprising the steps of:
(a) searching the TCAM for a longest prefix match for the key; (b) searching the additional storage in parallel with the TCAM for the almost exact match for the key; (c) returning the longest prefix match having a lowest or a highest location if the longest prefix match is found in the TCAM and the almost exact match is not found in the additional storage.
- 7. A computer-readable medium containing a program for storing prefixes for a plurality of rules in a computer system, the computer system having a ternary content addressable memory (TCAM), the plurality of rules using at least one range of values in at least one dimension and corresponding to a plurality of prefixes, the at least one range being described by at least one prefix, a portion of the plurality of rules capable of intersecting, the program including instructions for:
(a) providing a plurality of priorities for the plurality of rules, the plurality of priorities including at least one different priority for the portion of the plurality of rules that intersect; and (b) storing the plurality of prefixes in the TCAM in at least one block in an order based upon the plurality of priorities of the plurality of rules.
- 8. The computer-readable medium of claim 7 wherein the computer system further includes an additional storage and wherein the plurality of rules are further capable of including at least one rule capable of having an almost exact match, the program further including instructions for:
(c) separately storing in the additional storage at least one corresponding prefix for the at least one rule having the almost exact match, the additional storage capable of being searched independently from the TCAM.
- 9. The computer-readable medium of claim 7 wherein the storing instructions (b) further includes instructions for:
(b1) storing the plurality of prefixes such that a portion of the plurality of rules having identical priorities are stored in a single block.
- 10. The method of claim 9 wherein the storing step (b1) further includes the steps of:
(b1i) moving a first entry for each subsequent block to an end of the subsequent block; and (b1ii) inserting a higher priority entry in a previous block.
- 11. A computer-readable medium containing a program for searching prefixes for a plurality of rules in a computer system for a match for a key, the computer system having a ternary content addressable memory (TCAM) and an additional storage, the plurality of rules using at least one range of values in at least one dimension and corresponding to a plurality of prefixes, the at least one range being described by at least one prefix, a portion of the plurality of rules capable of intersecting, a plurality of priorities corresponding to the plurality of rules, the plurality of priorities including at least one different priority for the portion of the plurality of rules that intersect, the plurality of prefixes being stored in the TCAM in an order based upon the plurality of priorities of the plurality of rules, the plurality of rules are further capable of including at least one rule capable of having an almost exact match, the additional storage at least one corresponding prefix for the at least one rule having the almost exact match, the additional storage capable of being searched independently from the TCAM, the program including instructions for:
(a) searching the TCAM for a longest prefix match for the key; (b) searching the additional storage in parallel with the TCAM for the almost exact match for the key; (c) returning the longest prefix match having a lowest or a highest location if the longest prefix match is found in the TCAM and the almost exact match is not found in the additional storage.
- 12. A system for storing prefixes for a plurality of rules in a computer system, the plurality of rules using at least one range of values in at least one dimension and corresponding to a plurality of prefixes, the at least one range being described by at least one prefix, a portion of the plurality of rules capable of intersecting, the system comprising:
a plurality of hosts for transmitting and receiving data; a ternary content addressable memory (TCAM); means for providing a plurality of priorities for the plurality of rules, the plurality of priorities including at least one different priority for the portion of the plurality of rules that intersect; and means for storing the plurality of prefixes in the TCAM in at least one block in an order based upon the plurality of priorities of the plurality of rules.
- 13. The system of claim 12 wherein the plurality of rules are further capable of including at least one rule capable of having an almost exact match, the system further comprising:
an additional storage; and means for separately storing in the additional storage at least one corresponding prefix for the at least one rule having the almost exact match, the additional storage capable of being searched independently from the TCAM.
- 14. The system of claim 12 wherein the storing means further includes:
means for storing the plurality of prefixes such that a portion of the plurality of rules having identical priorities is stored in a single block.
- 15. The system of claim 14 wherein the storing means further moves a first entry for each subsequent block to an end of the subsequent block and inserting a higher priority entry in a previous block.
- 16. The system of claim 12 wherein the plurality of rules are a plurality of filter rules.
- 17. A system for searching prefixes for a plurality of rules in a computer system for a match for a key, the plurality of rules using at least one range of values in at least one dimension and corresponding to a plurality of prefixes, the at least one range being described by at least one prefix, a portion of the plurality of rules capable of intersecting, a plurality of priorities corresponding to the plurality of rules, the plurality of priorities including at least one different priority for the portion of the plurality of rules that intersect, the system comprising:
a network processor; a ternary content addressable memory (TCAM), the plurality of prefixes being stored in the TCAM in an order based upon the plurality of priorities of the plurality of rules, the plurality of rules are further capable of including at least one rule capable of having an almost exact match, the TCAM being searched for a longest prefix match for the key; and an additional storage, the additional storage at least one corresponding prefix for the at least one rule having the almost exact match, the additional storage capable of being searched independently from the TCAM, the additional storage being in parallel with the TCAM for the almost exact match for the key, the longest prefix match being having a lowest or a highest location being returned from the TCAM if the longest prefix match is found in the TCAM and the almost exact match is not found in the additional storage.
CROSS-REFERENCE TO RELATED APPLICATIONS
[0001] The present invention is related to co-pending U.S. patent application Ser. No. 09/540,333, filed on Mar. 31, 2000 and entitled “SYSTEM METHOD AND COMPUTER PROGRAM FOR PRIORITIZING FILTER RULES” and assigned to the assignee of the present invention. The present invention is also related to co-pending U.S. patent application Ser. No. 09/761,939 on Jan. 16, 2001 and entitled “METHOD, SYSTEM AND COMPUTER PROGRAM PRODUCT TO PARTITION FILTER RULES FOR EFFICIENT ENFORCEMENT” and assigned to the assignee of the present invention. The present invention is also related to co-pending U.S. patent application Ser. No. 09/543,531 on Apr. 6, 2000 and entitled “FULL MATCH (FM) SEARCH ALGORITHM IMPLEMENTATION FOR A NETWORK PROCESSOR” and assigned to the assignee of the present invention.