Embodiment
For the purpose, technical scheme and the advantage that make the embodiment of the invention clearer; To combine the accompanying drawing in the embodiment of the invention below; Technical scheme in the embodiment of the invention is carried out clear, intactly description; Obviously, described embodiment is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills are not making the every other embodiment that is obtained under the creative work prerequisite, all belong to the scope of the present invention's protection.
Embodiment one
The structural representation of the treating apparatus that Fig. 1 provides for the embodiment of the invention one, as shown in Figure 1, the treating apparatus of present embodiment comprises: processor 11, Cache 12, storer 13 and TCAM controller 14.Processor 11 and Cache 12 and storer 13 are connected through internal bus; TCAM controller 14 also is connected through internal bus with Cache 12 and storer 13; Cache 12 also interconnects with storer 13, and wherein, internal bus comprises control bus, address bus and data bus.Wherein, Cache 12 is arranged between processor 11 and the storer 13, and its memory capacity is very little, but read or write speed is very fast, moves with the mode of associative storage 13, can adopt the static memory chip to realize.Wherein, Address mapping between Cache 12 and the storer 13 can be direct reflection, full reflection or the continuous reflection of group of linking to each other; Select direct image mode in embodiments of the present invention for use; Be that Cache 12 has identical address setting with storer 13, and have the recognition memory address ability, both can realize read-write operation through memory read instruction or memory write instruction to Cache 12.
Concrete, processor 11 is used for sending look-up command to TCAM controller 14, and this look-up command sends to TCAM device (being TCAM) through TCAM controller 14, carries out search operation for the TCAM device according to look-up command; Processor 11 also is used for sending reading order to read the lookup result corresponding with look-up command from Cache 12 or storer 13 simultaneously, and wherein, this reading order can be to read reading instruction of address space.Cache 12; Be used to store the lookup result that TCAM controller 14 provides; And judge according to the reading order that processor 11 sends whether it stores lookup result, and, supply processor 11 from Cache 12, to read lookup result judging when having lookup result.Storer 13 also is used to store the lookup result that TCAM controller 14 provides, and when Cache 12 is judged its inside and do not had the lookup result that processor 11 will read according to reading order, supplies processor 11 from storer 13, to read lookup result.Concrete, when processor 11 (for example: CPU (Center Processing Unit; Abbreviate as: CPU)) see a group address off and remove reference-to storage 13, the address that Cache 12 (Cache) wants examine processor 11 to see off, whether the address location that decision processor 11 will be visited is in Cache 12.If; Being called Cache hits; Processor 11 can carry out read/write operation to Cache with the speed that is exceedingly fast, and at this moment Cache 12 will notify storer 13 not see identical lookup result off, because the access rate of Cache 12 is far away faster than storer 13; Therefore, can in time notify storer 13; If do not exist, it is miss then to be called Cache, at this moment just need from storer 13, obtain lookup result, and with this content replication of visiting adjoining storage space in Cache.
TCAM controller 14 is used for the look-up command that receiving processor 11 sends through Cache 12; And look-up command sent to the TCAM device; Carry out search operation for the TCAM device according to look-up command; And receive the lookup result that the TCAM device returns, and according to the address information of obtaining in advance with lookup result store into simultaneously in Cache 12 and the storer 13 respectively with the address information corresponding memory space in, concrete; TCAM controller 14 can carry out write operation to Cache 12 and storer 13 through seeing address information off, and lookup result is stored in Cache 12 and the storer 13.
The treating apparatus of present embodiment; Between processor and TCAM controller, set up Cache and storer, the TCAM controller is the address of the address space of store storage lookup result in advance, can the lookup result that receive directly be sent in Cache and the storer; Make processor directly from Cache, read lookup result; Compared with prior art, reduce the time delay that processor reads lookup result, improved the search efficiency of whole search procedure.
Further, TCAM controller 14 comprises address table unit 141, is used for storage address information, and wherein address information is that processor is 11 pre-assigned, the address of the storage space that is used to store the corresponding lookup result of look-up command.
Further, as shown in Figure 2, TCAM controller 14 also comprises: first interface unit 142, order and data register 143, send scheduling queue 144, second interface unit 145 and the first result cache district 146.
First interface unit 142 is used for the look-up command that receiving processor 11 sends, and stores look-up command into order and data register 143, sends dispatch command to sending scheduling queue 144 simultaneously; And be used for according to address table unit 141 address stored information with the lookup result in the first result cache district 146 store into simultaneously in Cache 12 and the storer 13 respectively with the address information corresponding memory space in; Order and data register 143 are used to store look-up command; Send scheduling queue 144 and be used for reading look-up command from order and data register 143, and look-up command is offered second interface unit 145 according to dispatch command; Second interface unit 145 is used for look-up command is sent to TCAM, carries out search operation for TCAM according to look-up command, and is used to receive the lookup result that TCAM returns, and lookup result is stored in the first result cache district in 146; The first result cache district 146 is used to store the lookup result that second interface unit 145 receives, and first interface unit 142 is stored into the lookup result of being stored in Cache 12 and the storer 13 according to address information.
Further, the processor 11 of present embodiment comprises a plurality of processing units; Wherein, a plurality of processing units are respectively applied for to TCAM controller 14 and send the look-up command of carrying the processing unit sign, and send reading order from Cache 12 or storer 13, to read the lookup result that carries like-identified with look-up command.For example, support the treating apparatus of multithreading, wherein each thread can be regarded as a processing unit, can send look-up command to TCAM controller 14 simultaneously.In order to distinguish the look-up command that different threads sends; Can be through their label of unique differentiation be provided for each thread; As the sign (being the processing unit sign) of each thread, and through making look-up command and lookup result all carry look-up command and the lookup result of the sign of corresponding thread with the differentiation different threads.
Embodiment two
The structural representation of the information searching system that Fig. 3 provides for the embodiment of the invention two, as shown in Figure 3, the information searching system of present embodiment comprises treating apparatus 31 and TCAM device 32.Treating apparatus 31 treating apparatus that can be provided for the embodiment of the invention one wherein, its concrete structure is as depicted in figs. 1 and 2, and present embodiment is introduced no longer in detail.
TCAM device 32 is connected with TCAM controller 14, is used to receive the look-up command that the TCAM controller sends, and carries out search operation according to look-up command, and lookup result is offered TCAM controller 14.
Concrete, as shown in Figure 4, TCAM device 32 comprises: link block 321 and TCAM module 322; Wherein TCAM module 322 is mainly used in according to the information of searching and accomplishes search operation, is stored with various tables; Link block 321 main conversion and the responsible lookup results of handling of accomplishing look-up command.
Wherein, link block 321 mainly comprises: the 3rd interface unit 3211, order buffer area 3212, data buffer area 3213, the 4th interface unit 3214 and the second result cache district 3215; The 3rd interface unit 3211 is connected with data buffer area 3213 with order buffer area 3212; Be used to receive the look-up command that TCAM controller 14 sends; And resolve look-up command and become command frame and Frame, and store command frame and Frame into order buffer area 3212 and data buffer area 3213 respectively; And from the second result cache district 3215, read lookup result; The 4th interface unit 3214; Be connected with TCAM module 322 with order buffer area 3212, data buffer area 3213; Be used for that command frame and Frame are translated into the information of searching and offer TCAM module 322; Make TCAM module 322 carry out search operation, and receive the lookup result that TCAM module 322 is returned according to the information of searching; The second result cache district 3215 is connected with the 4th interface unit 3214, is used to receive the lookup result that the 4th interface unit 3214 obtains, and reads for the 3rd interface unit 3211.
The information searching system of present embodiment is realized based on treating apparatus of the present invention; Through between processor and TCAM controller, setting up Cache and storer; The TCAM controller is the address of the address space of store storage lookup result in advance, can the lookup result that receive directly be stored in Cache and the storer, makes processor directly from Cache, read lookup result; Reduce the time delay that processor reads lookup result, improved search efficiency.In addition; Simultaneously lookup result is stored in the storer, when processor reads the lookup result failure in Cache, can from storer, read; When the raising processor reads lookup result speed, guarantee that also processor can read lookup result.
To introduce the principle of work of treating apparatus of the present invention and disposal system below through specific embodiment.
Embodiment three
The process flow diagram of the information searching method that Fig. 5 provides for the embodiment of the invention three.The executive agent of present embodiment is the TCAM controller in the treating apparatus of the present invention, and as shown in Figure 5, the information searching method of present embodiment comprises:
Step 101, the look-up command that TCAM controller receiving processor sends offers the TCAM device with look-up command, carries out search operation for the TCAM device according to look-up command, and receives the lookup result that the TCAM device returns;
Concrete; Processor sends look-up command and gives the TCAM controller, and the TCAM controller sends to the TCAM device with look-up command through bus (can be parallel bus, also can be high-speed serial bus); After the TCAM device receives look-up command, carry out search operation according to look-up command.After search operation finished, the TCAM device was known the look-up command that this lookup result is corresponding.The TCAM device is preferably high-speed serial bus through bus, and lookup result is sent to the TCAM controller.Wherein processor can be central processing unit (CPU), network processing unit (NP) or dedicated IC chip (ASIC), and the look-up command of being sent can be the order of searching routing table, ACL table or MAC table.
For the treating apparatus of supporting multithreading, wherein processor comprises a plurality of processing units, and a plurality of processing units can send a plurality of look-up commands simultaneously, and distinguishes the corresponding look-up command of different threads through sign.
Step 102, according to the address information of obtaining in advance with lookup result store into simultaneously in Cache and the storer with the address information corresponding memory space in, read lookup result for processor.
Wherein, processor is allocated the address of the storage space of storage lookup result in advance, and the address of the storage space that for example distributes is 0001H, and this address 0001H is simultaneously corresponding to the 0001H address location in Cache and the storer.Processor sends to the TCAM controller with the address (0001H) of storage space; The TCAM controller receives the also address (0001H) in store storage space, so that according to this address information the lookup result that receives is stored in Cache and the storer corresponding memory space.Concrete, the TCAM controller, stores lookup result in the 0001H corresponding address unit into after Cache and storer receive this write command through sending the instruction of writing the 0001H address location.
Further; When a plurality of look-up command; Processor will be allocated storage space in advance for the corresponding lookup result of each look-up command; Specifically can distinguish different lookup result corresponding memory space through sign; And the address that will identify and identify corresponding memory space sends to the TCAM controller, and the address of sign that the TCAM controller will receive and sign corresponding memory space is stored in the address mapping table, so that according to this address mapping table the lookup result that receives is stored in the corresponding memory space.Wherein sign can be to distribute different labels for every look-up command; Also can be to distribute different labels for the processing unit that sends look-up command; For example in the processor of supporting multi-hardware thread; Each hardware thread can be regarded as a processing unit, and each processing unit all can send look-up command.
The TCAM controller receives lookup result, obtains the sign in the lookup result, for example corresponding to the label of each processing unit, and searches address mapping table according to sign and obtains the address with this sign corresponding memory space.
Get access to the address of storage space when the TCAM controller after; Store lookup result in Cache and the storer storage space simultaneously through data bus; Wherein the address setting of Cache is identical with the address setting of storer, and Cache has the ability of recognition memory address, and since the TCAM controller be connected with storer with Cache; Therefore, Cache can normally receive the lookup result that the TCAM controller sends.
Wherein, The operation that processor reads lookup result specifically comprises: processor reads to store the read operation instruction of address space of lookup result to read lookup result, because the access speed of Cache is higher than the access speed of storer far away, therefore through transmission; This reads instruction and at first reads Cache; Only when reading cache miss, processor just obtains lookup result from storer, improved the speed that reads lookup result.Concrete; Cache is arranged between processor and the storer, and processor sends to Cache and storer simultaneously and reads instruction, if having corresponding lookup result in the Cache; Then Cache returns to processor to this lookup result; To the storer message of giving notice, do not see the identical lookup result of storage to processor off simultaneously, because the access speed of Cache is higher than the access speed of storer far away with instruction memory; Therefore, Cache can in time be notified storer.When the processor access Cache is unsuccessful; Be not have corresponding lookup result in the Cache, then Cache can not return lookup result to processor, and not to the storer message of giving notice; Therefore; Storer can be seen corresponding lookup result to processor off according to reading instruction of sending of processor, and promptly when not having lookup result in the Cache, processor can obtain this lookup result through reference-to storage.
The information searching method that present embodiment provides stores in the TCAM controller through the address that will store the storage space of lookup result in advance, when the TCAM controller receives lookup result; According to address stored information in advance, simultaneously lookup result is stored in Cache and the storer, rather than lookup result is stored in the storage space of TCAM self; Through this technical scheme; Processor can directly read Cache and obtain lookup result, has improved the speed that reads lookup result, has reduced to read the time delay of lookup result; Especially when TCAM adopts HSSI High-Speed Serial Interface, reduced of the restriction of TCAM controller to search procedure.
Embodiment four
The process flow diagram of the information searching method that Fig. 6 provides for the embodiment of the invention four.Present embodiment is corresponding with embodiment three, and its executive agent is the processor in the treating apparatus, and the information searching method of present embodiment comprises:
Step 201, processor wait for a period of time after sending look-up command; Wherein the time of processor wait can be random time, execution in step 202 after the stand-by period arrives.
Step 202, processor read Cache to obtain the corresponding lookup result of look-up command.Wherein, lookup result be the TCAM device carry out that look-up command obtains and by the TCAM controller when receiving the lookup result that the TCAM device returns, store into simultaneously in Cache and the storer.
Concrete; Processor is before reading lookup result; The address of the storage space of storing lookup result is sent to the TCAM controller; The TCAM controller receives also stores this address information, so as according to this address information with lookup result store into simultaneously in Cache and the storer with this address corresponding memory space in.
When processor sends a plurality of look-up command; To be the corresponding lookup result memory allocated space of each look-up command; And with the storage space that identifies the lookup result of distinguishing different look-up commands and look-up command correspondence; The address that will identify and identify corresponding memory space simultaneously sends to the TCAM controller; The sign that the TCAM controller will receive stores in the address mapping table with the address of the storage space of corresponding sign, and wherein sign can be that processor is the label that every look-up command distributes, for example label 1 corresponding article one look-up command, label 2 corresponding second look-up commands, label 3 corresponding the 3rd look-up commands etc.; Also can be processor the be label that each processing unit distributes, for example label 1 is corresponding to first processing unit, and label 2 is corresponding to second processing unit etc.
The TCAM controller receives the lookup result that the TCAM device returns, and wherein in order to distinguish the corresponding lookup result of different look-up commands, can carry the sign identical with look-up command in the lookup result that the TCAM device returns; The TCAM controller obtains storage space according to the sign in the lookup result from address mapping table address is stored lookup result in Cache and the storer into simultaneously; Concrete, the TCAM controller can store lookup result in Cache and the storer into through the instruction of memory write simultaneously, and Cache has identical address setting with storer, and has the ability of recognition memory address.
Processor reads Cache to obtain lookup result, and concrete processor realizes reading the purpose of Cache through sending the instruction of memory read.
The information searching method of present embodiment; Adopt the TCAM controller in advance the store storage space the address and store lookup result in Cache and the storer technical scheme simultaneously according to the address of storage space; Processor can directly read lookup result from Cache, from the TCAM controller, read the prior art of lookup result with processor and compare, and its time for reading postpones little; Reading speed is fast, has improved the efficient of whole search procedure; Simultaneously, the present technique scheme has obviously reduced the restriction of TCAM controller to search procedure, especially when adopting the high-speed serial communication interface between TCAM device and the TCAM controller.
Further; When processor is read Cache and is not got access to lookup result; Can automatically change and remove to read storer to obtain lookup result, promptly processor through send read the reading instruction of address corresponding memory space after, treating apparatus can read Cache earlier; And when not reading lookup result, continue memory read and can read lookup result to guarantee processor.This step can improve the reliability that processor reads lookup result.
Further, for example as a plurality of processing units, and possibly there are a plurality of lookup results of same processing unit in each processing unit corresponding to when sign in Cache or the storer, and then processor might read wrong lookup result.Therefore; The information searching method of present embodiment also comprises: after processor reads lookup result; Whether the interpretation lookup result is effective lookup result; Be meant effectively that wherein the lookup result that reads is the look-up command of corresponding current transmission, rather than the corresponding lookup result of other look-up commands of sending constantly.Concrete, realize that through in lookup result, being provided with the valid flag position for example working as the effective marker position is that " 1 " sign lookup result is effective, otherwise, if the effective marker position is " 0 ", explain that then lookup result is invalid.Simultaneously; Processor also need be provided with the effective marker position of the lookup result that reads; Promptly after processor reads lookup result; Need storer and Cache in effective flag of lookup result be set to invalidly, for example be set to " 0 ", lookup result will become invalid lookup result this moment.Wherein,, then the lookup result in the Cache is provided with,, then no longer invalid operation need be set if the lookup result in the Cache is capped if the lookup result of Cache also exists.
To be example with the processor of supporting a plurality of hardware threads below, and introduce the implementation process of technical scheme of the present invention in detail, wherein each hardware thread be as a processing unit.
Embodiment five
The process flow diagram of the information searching method that Fig. 7 provides for the embodiment of the invention five, present embodiment can realize that as shown in Figure 7, the information searching method of present embodiment comprises based on above-mentioned treating apparatus embodiment and each method embodiment:
Step 301, processor are each processing unit memory allocated space, and the initialization storage space; Concrete, storage space is used to store the lookup result of each processing unit, and the address realm of the storage space of each processing unit is separate.Processor is distinguished different processing units through label; And with the label of processing unit as the sign of distinguishing storage space; Be that the label of processing unit and the storage space of processing unit exist mapping relations, wherein storage space is meant the storage unit in storer and the Cache.For example, suppose to have 3 processing units, the label of each processing unit is 11,12 and 13, and the address of the corresponding storage space that distributes is 0100H, 0104H and 0108H; Wherein, processor is through realizing the initialization to storage space with all writing " 0 " in these storage spaces.
Step 302, processor sends to the TCAM controller with the mapping relations of the label of the address of storage space and processing unit;
Integrating step 31 for example, then processor can be in advance sends to the TCAM controller with the address 0108H of address 0104H, label 13 and its pairing storage space of address 0100H, label 12 and its pairing storage space of label 11 and its pairing storage space.
Step 303, the TCAM controller stores the label of the processing unit that receives and the address of storage space in the address mapping table into;
The TCAM controller receives and the label of each processing unit and the address of its corresponding memory space is stored in the address mapping table.
Above-mentioned steps 301-step 303 is used for being implemented in TCAM controller memory address mapping table in advance, and above-mentioned steps can be carried out in advance.
Step 304, processor sends look-up command to the TCAM controller, and wherein look-up command has the label of processing unit;
In the present embodiment, processor can send look-up command, read command and write order, and wherein look-up command is used for sending search request to TCAM; Read command and write order can be used for reading or writing the internal register in the processor, and present embodiment introduces look-up command, so a kind of form of look-up command is provided.
Concrete, comprise label, operational code, table information or address, key word or data four parts in this look-up command form.Wherein, table 1 has been introduced the implication of each several part in the present embodiment look-up command in detail, and is specifically as shown in table 1.
Table 1
Content |
Explain |
Label |
The unique identification of each processing unit.For example, the label of processing unit 0 is 0, and the label of processing unit 1 is 1, and the label of processing unit n is n. |
Operational code |
Be used to distinguish look-up command, read command and write order. |
Table information or address |
In look-up command, this part dress be table information, be used for specifying searched be TCAM concrete which open or which opens table; In the reading and writing order, what this part was adorned is device number and the internal register addresses of TCAM. |
Key word or data |
In look-up command, this part dress be key word, the content of just extracting in the packet, the foundation as searching goes for corresponding results according to it; In write order, what this part was adorned is the data that need be written into TCAM; In read command, there is not this part. |
Processor sends to the TCAM controller through Cache with look-up command in the present embodiment, and the TCAM controller receives look-up command through data bus.
Step 305, the TCAM controller is transmitted to the TCAM device with look-up command;
Concrete; The TCAM controller will receive look-up command frame and the Frame that high-speed serial bus is translated in look-up command; And send into respectively in the command register and data register in the TCAM controller; Simultaneously the TCAM controller is given corresponding label (for example label 11,12 and 13) and is sent scheduling in the row, and the number of present embodiment hypothesis command register and data register and processing unit are that the number of label is identical.
The principle of " FIFO " is followed in the transmit queue scheduling; From formation, take out label (for example label 11,12 and 13) successively and discern; Then; In command register and data register, read corresponding look-up command frame and Frame according to label, send to the TCAM device through universal serial bus.
Step 306, the TCAM device receives the look-up command that has label that the TCAM controller sends, and carries out search operation according to look-up command;
Concrete; The TCAM controller receives look-up command frame and the Frame on the universal serial bus, and sends into order buffer area and data buffer area successively according to the sequencing that receives, then; Content in order buffer area and the data buffer area is converted to can be by the signal of searching of TCAM device identification; Carry out search operation, promptly can know and search which table or which table according to searching signal, and the content of searching.
Step 307, the TCAM device generates the result data frame according to lookup result and sends to the TCAM controller through universal serial bus;
Concrete, the TCAM device is sent to the result cache district with lookup result earlier, knows corresponding label according to searching the time that is spent then; Label is inserted in the lookup result; Form the lookup result Frame, deliver on the universal serial bus, lookup result is sent to the TCAM controller through universal serial bus.
Wherein, because the TCAM device time that search procedure spent is each time fixed, therefore,, the TCAM device knows the look-up command that lookup result is corresponding when executing search operation.For example, suppose that the TCAM device searches signal to finish be 10 clock period to searching from sending, therefore, search the lookup result that obtains at every turn and be the signal of searching that sends before 10 clock period, so can add corresponding label in the lookup result to.In the present embodiment, promptly obtain carrying the lookup result of label 11, the lookup result that carries the lookup result of label 12 and carry label 13.
Corresponding, present embodiment also provides a kind of structure of result data frame, and it comprises: label, significant notation, successful mark and result's particular content.Table 2 has been introduced the implication of each several part in the Frame as a result in detail.
Table 2
Content |
Explain |
Label |
The unique identification of each processing unit.For example, the label of processing unit 0 is 0, and the label of processing unit 1 is 1, and the label of processing unit n is n. |
Significant notation |
Show that whether effectively this result. |
The success mark |
Show whether successful this searches.If do not exist in the look-up table with look-up command in the related result of key word, then this time searched unsuccessful. |
Result's particular content |
The content that arrives according to keyword search. |
Step 308, TCAM controller receive the result data frame on the universal serial bus, and lookup result is stored in storer and the Cache in the corresponding memory space simultaneously;
Concrete, TCAM controller reception result Frame is also temporary in the result cache district with the result data frame; Then, from the result cache district, take out the result data frame, the result data frame is resolved obtain label according to the principle of FIFO; Then, according to the address that label inquire address mapping table obtains the storage space of storage lookup result, store lookup result simultaneously in storage space and the Cache.For example: when the TCAM controller receives the lookup result that carries label 12; Obtain the label 12 in the lookup result through resolving lookup result; And search address mapping table according to the label that obtains 12, obtain the address 0104H with label 12 corresponding memory space, because this address corresponding Cache and storer simultaneously; Therefore; According to this address 0104H, the TCAM controller can be with in lookup result write cache device and the storer, is that 12 processing unit reads lookup result through reading address 0104H for label.
Step 309, processor reads Cache, to obtain lookup result;
In this step; Processor obtains lookup result through reading Cache; Because the speed of processor access Cache is more a lot of soon than the speed of reference-to storage, especially the speed than visit TCAM controller is a lot of soon, therefore; This step can make processor get access to lookup result faster, and the operation of wherein reading Cache can be realized by the memory read instruction.
Because the capacity of Cache is relatively limited, and the address space of Cache is recycled, and the content that store in the early time its inside might be replaced by follow-up other guide of coming in.Therefore,, wait until when processor reads, might can not find that therefore, the information searching method of present embodiment also comprises judges the operation whether lookup result is arranged in the Cache, i.e. step 400 though lookup result is stored in the Cache.
Step 400 judges whether lookup result is arranged in the Cache;
The address of the storage space that will visit that this step specifically can be seen off according to processor by Cache is judged; Promptly judge the space of whether also using the address of seeing off corresponding to processor in the Cache; If exist; Then can judge and have corresponding lookup result in the Cache, for example corresponding lookup result with label 12, then execution in step 402; Otherwise, execution in step 401.
Step 401 reads lookup result from storer with in the corresponding memory space of address, and execution in step 402.
Concrete, the mode that processor is read storage space is a prior art, this step is not done detailed argumentation.
Step 402 judges whether the lookup result that reads is effective;
Concrete, judge through the effective marker position in the lookup result whether lookup result is effective, for example,, explain that then lookup result is effective, execution in step 404 if the effective marker position is " 1 "; Otherwise, if the effective marker position is " 0 ", explain that then lookup result is invalid, change and go execution in step 403.
Step 403, is changeed and is gone execution in step 309 at processor random wait a period of time;
Wherein, it is leading that possible processor reads the operation of lookup result, and actual search procedure also finishes, and perhaps lookup result also is not stored in storer or the Cache, thereby makes processor can't read effective lookup result.
Step 404, whether the processor judgement searches successful;
Concrete, processor judges according to the successful zone bit in the lookup result whether search procedure is successful in this step, for example if successful zone bit is searched successfully for " 1 " expression, promptly in look-up table, finds the result corresponding with look-up command, and execution in step 406; Otherwise, explain and search not success, promptly in look-up table, do not find the result corresponding with look-up command, change and go execution in step 405.
Step 405, processor is carried out preset default action;
Wherein, owing in the routing table default route can be set usually, in whole table, search unsuccessfully, then return default route as lookup result, therefore, generally there is not unsuccessful situation in route querying.At some in particular cases, for example if in the routing table default route is not set, in case in whole routing table, search failure; Then can return the lookup result of " getting nowhere "; At this moment, processor can abandon this message, and this abandons operation and can be considered a kind of default action.It with the acl lookup again example; Be " getting nowhere " if judge current lookup result; Then think the characteristic of this message any rule in the ACL table that do not match, this message is left intact directly delivers to next processing links, can be considered another kind of default action.Behind EO, change and go execution in step 407, it is invalid that be revised as the effective marker position that is about to lookup result in Cache and the storer.
Step 406, processor is carried out concrete operations according to lookup result, and behind EO, execution in step 407;
For example, if lookup result is jumped routing address for next, then processor is transmitted to next with message and jumps the routing address corresponding equipment.Look for example with the ACL table again, if the result who returns is " current message is carried out speed limit ", then processor is carried out the speed limit action; If the result who returns is " being revised as 1 to the Priority flag of current message ", then processor is revised as 1 to the Priority flag of current message.
Step 407, it is invalid that processor is revised as the effective marker position of lookup result in Cache and the storer, and finish this search operation.
Concrete; This step 407 and step 402 binding operation; Can prevent processor in new search procedure, be used as this lookup result to last lookup result, thereby guaranteed that the lookup result that processor reads at every turn is the effective lookup result corresponding with look-up command.
The information searching method of present embodiment, TCAM controller directly store lookup result in storer and the Cache into through the address of the storage space that prestores; Make processor can directly from Cache, read lookup result; Improve the speed that processor reads lookup result, compared with prior art, reduced the time delay that processor reads lookup result; Reduced of the restriction of TCAM controller, and then improved the search efficiency of whole search procedure search procedure.
Further; Adopt high-speed serial bus between TCAM controller and the TCAM in the present embodiment; Present embodiment is not described in detail the concrete realization of high-speed serial bus; Present embodiment provides a kind of data frame format, is suitable on high-speed serial bus, transmitting, and combines information searching method of the present invention can further improve the seek rate of search procedure.Concrete:
In the present invention, frame length can be the multiple of 8Bytes, and present embodiment is with the 8Bytes example, and promptly the length of command frame, Frame and result frame all is 8Bytes.Wherein, command frame comprises: the address of the operational code of 8bits, the label of 8bits, 16bits or key word or the data of table information and 32bits, concrete form is shown in Fig. 8 a.Frame comprises key word or the data of 64bits, and concrete form is shown in Fig. 8 b.Result frame comprises: the lookup result of the successful position of the label of 8bits, the significance bit of 1bit, 1bit (promptly hit into) 154bits, concrete form is shown in Fig. 8 c.
Above-mentioned data frame format is the optimal way of a kind of fully embodiment of the present invention technical scheme and the technique effect of performance technical scheme of the present invention; But be not limited to this, those skilled in the art can combine the knowledge of self to select corresponding data frame format to come the embodiment of the present invention technical scheme.
One of ordinary skill in the art will appreciate that: all or part of step that realizes said method embodiment can be accomplished through the relevant hardware of programmed instruction; Aforesaid program can be stored in the computer read/write memory medium; This program the step that comprises said method embodiment when carrying out; And aforesaid storage medium comprises: various media that can be program code stored such as ROM, RAM, magnetic disc or CD.
What should explain at last is: above embodiment is only in order to explaining technical scheme of the present invention, but not to its restriction; Although with reference to previous embodiment the present invention has been carried out detailed explanation, those of ordinary skill in the art is to be understood that: it still can be made amendment to the technical scheme that aforementioned each embodiment put down in writing, and perhaps part technical characterictic wherein is equal to replacement; And these are revised or replacement, do not make the spirit and the scope of the essence disengaging various embodiments of the present invention technical scheme of relevant art scheme.