Claims
- 1. A method of preventing collisions between two or more binary keys wherein each binary key corresponds to an action to be taken, comprising the steps of:
providing a hash table having a plurality of entries indexed by a selected portion of hash values of said binary keys, each entry pointing to a location in a data structure for storing the non-selected portions of, or the entire hash value of, the binary key and action data corresponding to the value of the binary key, and a CAM having a plurality of entries, each configured to store a binary key, or a value unique to a binary key, and an association to a corresponding action associated therewith; storing in said hash table a pointer to said data structure using a selected one portion of the hash values of binary keys as an index into the hash table when and only when said selected one portion of the hash value is not the selected one portion of the hash value of any other binary key, and storing in the CAM binary keys or values unique to said binary keys, and establishing an association between said CAM entry locations and locations of said data structures, when and only when the selected portion of the hash value of any such binary key is the same as the selected portion of the hash value of one or more other binary keys.
- 2. The invention as defined in claim 1 further characterized by:
presenting a binary key for action; searching the CAM to see if the binary key is stored in said CAM; if said binary key is found, using established association with said data structure in order to access the action data associated therewith; hashing the binary key and accessing an entry in the hash table using a portion of resulting hashed binary key as an index into said hash table to determine if the selected entry of the hash table is valid; if the entry is valid, then pointing to said data structure in order to access the action data associated therewith.
- 3. The invention as defined in claim 2 wherein said CAM and said hash table are searched simultaneously.
- 4. The invention as defined in claim 2 wherein said CAM is searched first, and said hash table is searched if and only if the value of the binary key is not found in the CAM.
- 5. The invention as defined in claim 1 wherein said binary key is stored unaltered in the CAM.
- 6. The invention as defined in claim 2 wherein said binary key is stored unaltered in the CAM.
- 7. The invention as defined in claim 3 wherein said binary key is stored unaltered in the CAM.
- 8. The invention as defined in claim 4 wherein said binary key is stored unaltered in the CAM.
- 9. The invention as defined in claim 1 wherein said action is stored in the CAM.
- 10. The invention as defined in claim 1 wherein said action is directed by an offset value in said CAM location.
- 11. The method of claim 1 wherein deletion of an entry from the hash table or CAM is accomplished by:
seeking the binary key in the CAM and, if found, then deleting this key and ending the program; if the key is not found, then seek the selected portion of the hash value in the hash table, if a match is not found, end program; if a match is found, compare the remainder of hash value, if a match is found, delete portion of hash value from hash table; if a match is not found, end program.
- 12. The invention as defined in claim 1 wherein an insertion of a new value in the CAM or hash table is accomplished by:
seeking the value of the binary key in the cam; if the value is found, overwriting the key and associated action and the program ended; if the key is not found in the CAM, the key is hashed, the selected hash value is sought in the hash table, if the selected value is not found in the hash table, the selected value is written in the hash table with a pointer to the action and the remainder of the hash value, and the program is ended; if the selected portion of hash value is stored in the hash table with a pointer to the remainder of the hash value, the action is updated and the program ended; if the remainder of the hash value is different corresponding to a different action, then enter the key of the selected portion of the hash value being compared into the CAM with the associated activity, recreate the key from the hash value stored in the hash table and action, and enter the recreated key in the CAM and associated action and end the program.
- 13. A structure for preventing collisions between two or more binary keys wherein each binary key corresponds to an action to be taken comprising:
a hash table having a plurality of entries indexed by a selected portion of hash values of said binary keys, each entry pointing to a location in a data structure for storing the non-selected portions of, or the entire hash value of, the binary key and action data corresponding to the value of the binary key; a CAM having a plurality of entries, each configured to store a binary key, or a value unique to a binary key, and an association to a corresponding action associated therewith; each entry in said hash table having an entry and a pointer to said data structure using a selected one portion of the hash values of binary keys as an index into the hash table when and only when said selected one portion of hash value is not the selected one portion of the hash value of any other binary key.
- 14. The invention as defined in claim 13 wherein said value stored in the CAM is the unaltered value of each key.
- 15. The invention as defined in claim 13 wherein said action related to each entry in said CAM is stored in said CAM.
- 16. The invention as defined in claim 14 wherein said action related to each entry in said CAM is stored in said CAM.
- 17. The invention as defined in claim 13 wherein said action related to each entry in said CAM is designated by an offset.
- 18. The invention as defined in claim 14 wherein said action related to each entry in said CAM is designated by an offset.
RELATED APLICATION
[0001] This application is related to commonly owned application Ser. No. 09/210,222, filed Dec. 19, 1998, for “Hash Function for IP, MAC, and Other Structured Addresses”.