The communications industry is rapidly changing to adjust to emerging technologies and ever increasing customer demand. This customer demand for new applications and increased performance of existing applications is driving communications network and system providers to employ networks and systems having greater speed and capacity (e.g., greater bandwidth). In trying to achieve these goals, a common approach taken by many communications providers is to use packet switching technology. Increasingly, public and private communications networks are being built and expanded using various packet technologies, such as Internet Protocol (IP).
A network device, such as a switch or router, typically receives, processes, and forwards or discards a packet based on one or more criteria, including the type of protocol used by the packet, addresses of the packet (e.g., source, destination, group), and type or quality of service requested. Additionally, one or more security operations are typically performed on each packet. But before these operations can be performed, a packet classification operation must typically be performed on the packet.
Packet classification as required for, inter alia, access control lists (ACLs) and forwarding decisions is a demanding part of switch and router design. The packet classification of a received packet is increasingly becoming more difficult due to ever increasing packet rates and number of packet classifications. For example, ACLs require matching packets on a subset of fields of the packet flow label, with the semantics of a sequential search through the ACL rules. IP forwarding requires a longest prefix match.
Known approaches of packet classification include using custom application-specific integrated circuits (ASICs), custom circuitry, software or firmware controlled processors, binary and ternary content-addressable memories (CAMs). The use of programmable software or firmware have advantages as they provide some level of flexibility, which becomes especially important as new protocols and services are added to existing network. Customer typically desire to use their existing hardware (e.g., routers, switches etc.) to support these new protocols and services. However, known software and firmware implementations are relatively slow, and typically place a performance bound which may be incompatible with new requirements. CAMs are increasingly being used in packet classification especially because of their performance. However, these content-addressable memories are typically expensive in terms of power consumption and space, and are limited in the size of an input word (e.g., 72, 144, etc.) on which a lookup operation is performed.
Various applications that use packet classification, such as Security Access Control, Quality of Service etc., typically need to perform many matches on source and destination port numbers, protocol and other header fields, etc.
One known approach for providing lookup capability on multiple data items is to use a separate CAM for each type of information being matched. For example, one CAM might be programmed with address information, another with quality of service information, and yet another with port information. Such an approach is expensive as it uses multiple CAMs. Needed are new methods and apparatus for implementing and using multiple virtual portions of a single associative memory, including a less costly approach for providing multiple CAM lookups on a data item.
A known approach for accommodating a lookup word having a greater length than that allowed by a single lookup word of a CAM uses a single CAM and breaks the desired lookup string into different segments and performs multiple lookups. A CAM is programmed with parent entries (i.e., those for matching a first segment) and child entries (e.g., those for matching the remaining segments), wherein each child entry includes the address of its parent as part of its lookup string to ensure that only children entries of a matched parent entry are matched. Additionally, child and parent entries contain a different two bit tag to ensure a child entry is not matched when a parent entry is desired, and vice versa. A first segment of the string is provided as input to the CAM to produce a matching address (e.g., page and word address). A lookup word including a second segment of the string along with the matching address and child tagging is then provided as input to the CAM to produce a second matching address. This process can be repeated wherein the child entry becomes the parent entry for another child entry. This approach uses a single CAM, however, the use of the address of a parent entry as the prefix for a lookup of a child entry is inflexible, and typically requires a fixed number of bits which may be excessive.
Another known approach for accommodating lookup word having a greater length than that allowed by a single lookup word of a CAM uses tags each succeeding stored entry in a long comparand with its sequence number. The first entry is tagged “1”, the second entry tagged “2”, the third entry is tagged “3”, and so forth. After the first match is found, the second portion of the unknown is entered into the comparand register along with the tag for “2”, and if a match is found, the Status register is examined to see if the match address is equal to the previous match address +1. If it is, then the third portion of the unknown can be loaded into the comparand with the tag for “3”, and so forth. If the match address is not an increment from the previous address, that means the mach has failed, and the first matching location should be set to “SKIP” and a CMP V issued to find the next higher match.