1. Field of the Invention
The present invention relates to a protocol processing apparatus and a method therefor.
2. Description of the Related Art
In network protocol processing, search processing based on a database termed a table is performed. Typical search processing includes a plurality of search processing such as an address resolution protocol (ARP) table search, socket table search, TCP control block (TCPCB) search, and routing table search. Loads caused by such search processing increase with growth of the network scale and a method for performing processing using hardware (or a dedicated processor) termed a dedicated search engine may be used.
A dedicated memory device termed a content addressable memory (CAM) is known and used in such a search engine. The CAM is a special memory that, when a search key (data) is input, outputs an address where registration data matching the search key is stored. Because the CAM simultaneously outputs registration data from all memory cells storing the registration data to compare them with the search key, a search can be performed at very high speed. However, the instantaneous current when registration data is output from all memory cells simultaneously, is large and a production process that is different from the process of normal logic is needed, CAM devices entail high cost.
As an alternative to the expensive CAM, an associative memory of a mode is known that uses a random access memory (RAM) and outputs results of successive comparison. Japanese Patent Application Laid-Open No. 2001-160291 discusses an associative memory as illustrated in
According to Japanese Patent Application Laid-Open No. 2001-160291, an address generation circuit 404 connected to the RAM sequentially outputs registration data in reference data memories 405, to realize the associative memory. Then, matching determinations with each search key are made by a plurality of matching determination circuits 406 and addresses are output when matched. The number of the reference data memories 405 is thereby reduced and a plurality of searches can be carried out at the same time.
However, in the above conventional device, if another search is requested while some search is being performed, another search cannot be performed before the search being performed terminates.
According to an aspect of the present invention, an apparatus including a generation unit configured to generate an address to be provided to a database, a plurality of search units, and a processing unit configured to perform the network protocol processing based on a search result by the plurality of search units. Each of the plurality of search units include, wherein the plurality of search units, including an input unit configured to input a search key, a comparison unit configured to compare data output from the database according to the address generated by the generation unit and the search key input by the input unit, a setting unit configured to set a search start address and a search end address generated by the generation unit, and a monitoring unit configured to monitor matching of the address generated by the generation unit and the search end address, wherein if another search request is issued while at least one of the plurality of search units is performing a search, data output from the database for the search being performed and the search key for another search are compared by a search unit other than the search unit performing the search and the search end address of another search is set based on the address where another search is started.
Further features and aspects of the present invention will become apparent from the following detailed description of exemplary embodiments with reference to the attached drawings.
The accompanying drawings, which are incorporated in and constitute a part of the specification, illustrate exemplary embodiments, features, and aspects of the invention and, together with the description, serve to explain the principles of the invention.
Various exemplary embodiments, features, and aspects of the invention will be described in detail below with reference to the drawings.
A first exemplary embodiment according to the present invention will be described below in detail with reference to attached drawings.
In
A comparing/search apparatus (search device) 104 compares output from the search database 101 and a search key. The comparing/search apparatus (search device) 104 also provides a search start address to the search address generation apparatus 102 and monitors a generated address. In
The comparing/search apparatus (search device) 104 includes an address register 105, an address monitoring apparatus 106, a search key register 107, and a comparator 108. The address register 105 holds search start/end addresses in the search database 101. The address register 105 sets the search start address and the search end address generated by the search address generation apparatus 102. The search address generation apparatus 102 generates addresses in order starting with a search start address set to the address register 105 and outputs the addresses to the search database 101. The address monitoring apparatus 106 controls the search address generation apparatus 102 and also monitors address output. More specifically, the address monitoring apparatus 106 monitors matching of the address generated by the search address generation apparatus 102 and the search end address set to the address register 105. The search key register 107 receives and holds a search key (data to be retrieved) and the comparator 108 compares output from the search database 101 and content of the search key register 107.
The search database 101 outputs data according to an address generated by the search address generation apparatus 102 and the comparator 108 compares data output from the search database and a search key input and held in the search key register.
First, information in the search database 101 will be described. In network protocol processing, a plurality of search processing such as an ARP table search, socket table search, and routing table search is performed and the width of search keys and depth of search (number of items to be retrieved) are different depending on the search object.
First, a basic search operation in the first exemplary embodiment will be described. When the search key and search type are input into the search key register 107, the comparing/search apparatus 104 issues start/end addresses in the search database 101 according to search type, to the address register 105 and notifies the address monitoring apparatus 106 thereof. The address register 105 sets a (search) start address and a (search) end address generated by the search address generation apparatus 102. If the search type is the ARP search, the start address is 0 and the end address i. The address monitoring apparatus 106 makes sure that the search address generation apparatus 102 has generated no address and then instructs the search address generation apparatus 102 to start generation of search addresses. The search address generation apparatus 102 generates addresses to be provided to the search database 101. Accordingly, addresses from the start address to the end address are continuously provided from the search address generation apparatus 102 to the search database 101.
Registration data corresponding to each address is output from the search database 101 and a comparison is made with a search key in the search key register 107 by the comparator 108. At this point, the comparator 108 selects registration data in the search database 101 and a search key as comparison objects and compares only data of the bit width defined for the search type.
At the time, if output of a response is requested for one search input, the search address generation apparatus 102 terminates the search. If, however, output of a plurality of responses is requested for one search input, the search address generation apparatus 102 continues to generate a search address. The search terminates when output from the search database 101 is completed up to the end address in this manner. The address monitoring apparatus 106 monitors matching of the address generated by the search address generation apparatus 102 and the (search) end address and terminates the search when both addresses match.
Next, a search operation when a plurality of search requests is made to one search object will be described.
First, when a search 1 is input at time #1, “Search 1” by the comparing/search apparatus 1 is started. The search 1 is an ARP table search in which the ARP search table in
Since the single hit is selected in the search 1, the search terminates when a “response 1” output from the comparing/search apparatus 1 is obtained, so that the search by the comparing/search apparatus 1 terminates before the end address=i. In
In the example in
As a result, addresses registered in the address register of the comparing/search apparatus 2 are: the start address=b and the end address=b−1. The addresses may be: the start address=b+1 and the end address=b. More specifically, if another search request (search 2) is input while at least one (comparing/search apparatus 1) of the comparing/search apparatus 104 is performing the “Search 1”, processing is performed as follows: the comparing/search apparatus 2 other than the comparing/search apparatus (search device) 1 performing the “Search 1” compares data output from the search database 101 for the “Search 1” being performed and a search key for another search (search 2). The comparing/search apparatus 2 sets the search end address of another search (search 2) to the address register of the comparing/search apparatus 2 based on the address where another search (search 2) was started. If the address monitoring apparatus 106 of the comparing/search apparatus 2 detects that the address generated by the search address generation apparatus 102 matches the search end address, the search 2 terminates.
If the search continues after the search by the comparing/search apparatus 1 terminates, and further the end address i for the initial search 1 is reached, the search is further performed by returning to the start address. Then, when the end address=b−1 is reached, the search by the search 2 terminates. The search by a single hit continues until the end address is reached only in a case where matching data is found at the end address or no matching data is found. Thus, even if a search is being performed by some comparing/search apparatus, output from the search database 101 can be used for searches by a plurality of comparing/search apparatuses if the searches are of the same type.
If the search 1 terminates after matching data is found in the search 2, address generation by the search address generation apparatus 102 is temporarily interrupted when the search 1 terminates. If the search 2 terminates after the search 1 terminates, address generation by the search address generation apparatus 102 is temporarily interrupted when the search 2 terminates. Address generation by the search address generation apparatus 102 is also temporarily interrupted when no matching data is found in the search 2 because a search by another comparing/search apparatus is not being performed if the search end address=b−1 of the comparing/search apparatus 2 is reached.
The time during which no search address is generated is used to write registration data into the search database 101. In an associative memory of the successive comparison method, a write operation into the search database 101 is prohibited in the search period because a comparison is made over a plurality of cycles. Thus, the time during which no search address is generated is detected by the address monitoring apparatus 106 to write data accumulated in the registration data buffer 103 into the search database 101. More specifically, the registration data buffer 103 stores data whose registration in the search database 101 is requested and, after a search by the comparing/search apparatus 104 terminates, data stored in the registration data buffer 103 is registered in the search database 101.
Subsequently, at time #5, a search 3 and a search 4 for the same search object are requested successively. The searches 3 and 4 are an ARP table search. Though the searches 3 and 4 are requested simultaneously, the searches 3 and 4 can be accomplished by using a plurality of the comparing/search apparatuses 1 and 2. Further, when a search 5 for a different search object is requested at time #6, the search request is registered in the search key register and address register of the comparing/search apparatus 3 available at this point. If the search 3 by the comparing/search apparatus 1 terminates at time #7, the search 4 by the comparing/search apparatus 2 continues and thus, a transition to search execution cannot occur immediately.
When the search 4 terminates at time #8, the start address stored in the address register of the comparing/search apparatus 3 is sent to the search address generation apparatus 102 to start the search 5. The search 5 is a routing table search. More specifically, if, while at least one of the units of the comparing/search apparatus 104 performs a search, there is another search request (search 5) that requests a search of data stored at an address different from that of the search being performed in the search database 101, the termination of the search being performed is awaited. Then, after the search being performed terminates, the search based on another search request (search 5) is started.
Even if a search result such as a response 5-1 or a search result 5-2 is output while a search is performed, address generation by the search address generation apparatus 102 and the search continue because the multi-hit is requested in the search 5. The search 5 terminates when output of the address by the search address generation apparatus 102 reaches the end address adr=k registered in the address register 105.
Next, based on the above description, an operation example of search processing accompanying network protocol processing will be described.
In the configuration illustrated in
Behavior performed during packet transmission/reception when the network apparatus (protocol processing apparatus) is connected to a network as illustrated in
First, when an IP packet to be transmitted is prepared in the memory 902 of the network apparatus (protocol processing apparatus), the network apparatus performs an operation termed routing to decide the transfer destination of the packet by referring to a table to deliver the packet to the transmission address. The table used to decide routing is termed a routing table. The transfer destination is not necessarily a transmission destination and may be a relay device such as a router or L3 (Layer 3) switch to control network routes.
It is also necessary for an apparatus having no packet transfer function and having no 1-port network interface to perform routing and
Thus, the comparator is constructed as illustrated in
In the case of
A longest match comparison result is obtained by adding a comparison result of each comparing/search apparatus when searches terminate, to a decode circuit based on priorities of the Netmask length (the longer Netmask length, the higher priority) (not illustrated). If matching data is obtained by the search whose Netmask is 255.255.255.255, the matching data is set as a search result. If no matching data is obtained by the search whose Netmask is 255.255.255.255 and matching data is obtained by the search whose Netmask is 255.255.255.0, the matching data is set as a search result. Subsequently, a result of the search based on 255.0.0.0 or that of the search based on 0.0.0.0 is successively adopted as a search result. Then, the storage memory based on the obtained result is referred to and an interface stored in the storage memory corresponding to the search result is decided as the interface to be output.
In the routing table search, the size of table itself is not generally large, but the search for each Netmask is needed so that improvement in speed can still be expected by, like the present exemplary embodiment, setting the same search address when the search of each Netmask length (the above four patterns) is performed in parallel.
If, as a result of routing, the transmission destination of the IP packet is to be an Ethernet (registered trademark) (eth0), it is necessary to add a MAC header to the head of the IP packet. Normally, an ARP table is available as a conversion table to a MAC address corresponding to an IP address. A destination MAC address corresponding to the table needs to be added to the MAC header of the IP packet to be transmitted. If no applicable IP address is found in the ARP table, an ARP request packet is broadcast to terminals of the network according to the address resolution protocol.
Assume, for example, that Device 1 transmits an ARP request packet to Network A and Device 3 transmits an ARP response packet to Device 1 in a network configured as illustrated in
According to the present exemplary embodiment, as described above, the search position of a search database can be determined by each search apparatus by preparing a search key register and an address register for each of a plurality of search apparatuses. Thus, an efficient search by the plurality of search apparatuses and various searches by the single search database can be achieved.
To operate various apparatuses to realize functions of the above exemplary embodiment, program code of software to realize functions of the above exemplary embodiment may be supplied to a computer in a system or an apparatus connected to the various apparatuses. Thus, exemplary embodiments realized by operating the various apparatuses according to the program stored in a computer (processor) of the system or the apparatus are also included in the scope of the present invention.
According to the present exemplary embodiment, as described above, search throughput can be improved by starting another search without waiting until a search being performed terminates.
While the present invention has been described with reference to exemplary embodiments, it is to be understood that the invention is not limited to the disclosed exemplary embodiments. The scope of the following claims is to be accorded the broadest interpretation so as to encompass all modifications, equivalent structures, and functions.
This application claims priority from Japanese Patent Application No. 2009-055212 filed Mar. 9, 2009, which is hereby incorporated by reference herein in its entirety.
Number | Date | Country | Kind |
---|---|---|---|
2009-055212 | Mar 2009 | JP | national |