Conciliate the network switch and the method for encapsulation process with the loop for complete tunnel encapsulation
Technical field
Content of the present invention relates to the tunnel and handles the treatment facility and the processing procedure of particularly in the tunnel processing procedure packet being carried out tunnel encapsulation and decapsulation.
Background technology
A lot of application such as interconnect between WLAN (wireless local area network), mobile IP, virtual enterprise network, IPv4 and the IPv6 network all need to use tunnel (tunnel) treatment technology.Before packet transmits by the tunnel, usually by switch a tunnel encapsulation (tunnel encapsulation) head is increased in the raw data packets, and this tunnel encapsulation head is based on head (header) information of this packet and calculates according to certain rule, and this encapsulation header also can be called tunnel header (tunnelheader).Based on above-mentioned tunnel encapsulation header, the packet after the encapsulation is transferred to the destination by the tunnel, i.e. the other end in tunnel.That is to say, in the tunnel transmission process, be to use the tunnel encapsulation header but not the header information of raw data packets carries out.Correspondingly, when the packet after above-mentioned encapsulation arrives the tunnel other end, by a switch above-mentioned tunnel encapsulation head is removed equally, above-mentioned packet is resumed and is raw data packets, based on the header information of raw data packets itself, this packet is sent to the final destination again.
At present, the switch that is used for such use generally includes system CPU and one or more exchange chip, and wherein exchange chip is from being divided into into formation processing module (Ingress PacketProcessing Module), dequeue processing module (Egress Packet Processing Module) in logic, going into processing queue, going out chief components such as processing queue.In above-mentioned tunnel processing procedure, raw data packets is increased the tunnel encapsulation head, it is the process of tunnel encapsulation, and to the removal of the packet after encapsulation tunnel encapsulation head, i.e. the process of decapsulation all is to finish by the system CPU of switch, shown in Fig. 3 a, Fig. 3 b.It is as follows to the process that raw data packets increases the tunnel encapsulation head:
The data to be transmitted bag arrives switch and is placed in one to go in the processing queue;
Above-mentionedly go into the formation processing module and from go into processing queue, extract next pending packet, determine according to this packet head information whether needs increase the tunnel encapsulation head, if desired, then send it to system CPU;
System CPU generates the tunnel encapsulation head according to the header information of above-mentioned packet, and the tunnel encapsulation head is increased on the above-mentioned packet, forms new packet, promptly has the packet of encapsulation header;
System CPU sends back the processing queue that of switch with the above-mentioned packet that has encapsulation header, and according to the tunnel encapsulation header the above-mentioned packet that has encapsulation header is sent the network port of switch by the dequeue processing module.
The above-mentioned packet that has encapsulation header will be transferred to the destination, tunnel by corresponding tunnel after being sent the network port of switch.Correspondingly, the process of the above-mentioned packet that has encapsulation header being separated tunnel encapsulation at the switch at place, destination, tunnel is as follows:
The above-mentioned packet that has an encapsulation header arrives tunnel other end switch, and is placed in one and goes in the processing queue;
Go into the formation processing module and from go into processing queue, extract next pending packet, and determine according to packet head information whether needs are separated tunnel encapsulation, if desired, then send it to system CPU;
System CPU is removed the above-mentioned tunnel encapsulation head that packet comprised that has encapsulation header, and this data packet recovery is become raw data packets;
System CPU sends back the above-mentioned processing queue that goes out with above-mentioned raw data packets, by the dequeue processing module raw data packets is sent the switch network port, is sent to the destination based on this packet of header information of raw data packets itself.
As seen, in above-mentioned whole process, no matter packet enters the processing before the tunnel, the processing when still leaving the tunnel is all wanted to enter above-mentioned exchange chip twice, also will be transferred to system CPU simultaneously.Not only passing in and out exchange chip influences treatment effeciency, and system CPU realizes the treatment effeciency that the tunnel is handled also to be influenced this packet by software, has also taken the resource of system CPU simultaneously, has further influenced the whole efficiency of switch.
For this reason, the inventor is desirable to provide a kind of network switch and corresponding method that above-mentioned tunnel encapsulation is efficiently handled, and it addresses the above problem under the situation that does not need system CPU to participate in.
Summary of the invention
For addressing the above problem, the inventor provides a kind of and in exchange chip inside packet has been carried out the network switch that tunnel encapsulation handles and corresponding method in a looping fashion by loop (Loopback) and improve treatment effeciency to packet, in this switch and employed method, do not need system CPU just to participate in directly and can finish the tunnel encapsulation processing procedure effectively.
Efficiently finish the network switch that tunnel encapsulation is conciliate encapsulation process by the loop, it comprises system CPU, several exchange chips, described exchange chip includes queue processing module, dequeue processing module again and goes into processing queue, goes out processing queue, it is characterized in that described exchange chip also comprises the special logic circuit that is specifically designed to the tunnel processing, be used to deposit the internal storage device of corresponding configuration data, and loop processing queue (Loopback queue).
Said system CPU is identical with system CPU of the prior art, and the whole network switch is played the master control effect, also possesses corresponding data processing function.
Above-mentioned special logic circuit, it makes to cooperatively interact according to following method into formation processing module, dequeue processing module and loop processing queue finishes the processing procedure of packet being carried out tunnel encapsulation and decapsulation by the mode of circular treatment in exchange chip inside, and no longer need to send packet to system CPU, in said process, also no longer need the participation of system CPU.
Above-mentioned internal storage device is used to deposit configuration data, so that exchange chip can determine how packet is handled, comprise the processing of carrying out tunnel encapsulation, decapsulation in circular treatment mode of the present invention, and other processing of being carried out in a conventional manner.
Above-mentioned loop processing queue is used to deposit those need carry out the packet that the tunnel is handled in a looping fashion by the loop.Like this, through going into the packet after formation processing module and dequeue processing module are handled,, also increased a kind of processing mode, promptly sent into these loop formations except sending system CPU according to the conventional treatment mode to or sending to the destination by the network port.
Above-mentioned loop processing queue is to go into processing queue through specifically defined, and system goes into processing queue to these and carried out definition it is used as the loop processing queue when initialization.
Above-mentioned exchange chip is a kind of special chip (ASIC, Application Special IntegratedCircuit, the special purpose integrated circuit, or be called the special purpose special chip, be referred to as " special chip " in the present invention), high-performance special chip (high feature switching ASIC) particularly.
Above-mentioned exchange chip also can be common special chip.
The above-mentioned network switch by the loop for complete tunnel encapsulation process, it is increased to the tunnel encapsulation head on the packet by following method:
The data to be transmitted bag arrives the processing queue of going into of above-mentioned switch, this switch go into the header information of formation processing module according to this packet, carry out a series of conventional treatment, and send into out processing queue;
The dequeue processing module judges whether that to the next pending packet in the dequeue need carry out tunnel encapsulation to this packet handles, if need, then the dequeue processing module produces a tunnel encapsulation head, this tunnel encapsulation head is increased in this packet, and the packet that will have an encapsulation header is delivered in the processing queue of loop;
Go into the formation processing module the next pending packet in the processing queue of above-mentioned loop is carried out conventional treatment, once more this packet is sent into out processing queue after disposing;
The dequeue processing module is handled next packet, if this packet has encapsulation header, then based on new data packet head just the tunnel encapsulation header handle, finally this packet is sent out away according to the tunnel encapsulation head.
Correspondingly, the above-mentioned network switch by the loop for complete tunnel encapsulation process, it can finish the processing of the packet of receiving that has the tunnel encapsulation head being separated tunnel encapsulation by following method:
The packet that has the tunnel encapsulation head by tunnel transmission arrives the processing queue of going into of the above-mentioned network switch by efficient loop for complete tunnel encapsulation process, and the formation processing module of going into of this switch is carried out conventional treatment to this packet;
After disposing,, then directly this packet is delivered to the loop processing queue and waited for that separating tunnel encapsulation handles if going into the formation processing module judges that this packet has the tunnel encapsulation head;
Go into the formation processing module packet that has encapsulation header in the processing queue of loop is removed the tunnel encapsulation head, and the packet after will handling is sent into the loop processing queue;
Go into the formation processing module and continue this packet is carried out conventional treatment, after disposing it is delivered to out processing queue according to the initial data packet header of the next pending packet in the processing queue of loop;
Dequeue is handled processing module the packet that goes out in the processing queue is carried out conventional treatment, and based on the initial data packet header of this packet it is sent switch by the network port.
Conventional treatment described in the above-mentioned steps, be meant and provided by the inventionly efficiently finish tunnel encapsulation with the loop and conciliate the network switch of encapsulation process and conciliate in the method for encapsulation process the employed tunnel encapsulation of carrying out with the loop for complete tunnel encapsulation accordingly and conciliate other processing modes or step beyond the specific process of encapsulation process that those skilled in the art can realize understanding described conventional treatment according to prior art.
By above-mentioned steps as seen, the invention enables the processing that packet is encapsulated in exchange chip, directly to finish, and no longer send system CPU to from exchange chip, thereby avoided packet to enter exchange chip for twice and taken the shortcoming of the resource of system CPU, and then improved the efficient that the tunnel is handled greatly.
Description of drawings
Fig. 1 is the principle schematic of tunneling technique.
Fig. 2 a is the data format of raw data packets.
Fig. 2 b is the data format that adds tunnel encapsulation head packet afterwards.
Fig. 3 a is that existing solution is carried out the operation principle schematic diagram that tunnel encapsulation is handled to packet.
Fig. 3 b is that existing solution is carried out the operation principle schematic diagram that decapsulation is handled to the packet that has the tunnel encapsulation head.
Fig. 4 a is that solution provided by the invention is carried out the operation principle schematic diagram that tunnel encapsulation is handled to packet.
Fig. 4 b is that solution provided by the invention is to carrying out the operation principle schematic diagram that decapsulation is handled.
Fig. 5 is that solution provided by the invention is carried out the flow chart that tunnel encapsulation is conciliate encapsulation process to the packet that has the tunnel encapsulation head.
Fig. 6 be in one embodiment of the present of invention to packet carry out going into processing queue in the process that tunnel encapsulation handles, go out processing queue, data variation in the processing queue of loop.The processing procedure of a packet has only been described for simplicity's sake, in the drawings.
Fig. 7 be with same embodiment shown in Figure 6 in the switch of the tunnel other end receive behind the packet that has the tunnel encapsulation head to this packet carry out going into processing queue in the process of decapsulation, go out processing queue, data variation in the processing queue of loop.The processing procedure of a packet has still only been described for simplicity's sake, in the drawings.
Label declaration
1, tunnel encapsulation equipment
11 system CPUs
12 exchange chips
121 go into processing queue 122 goes out processing queue 123 loop processing queue
Carry out each process of tunnel encapsulation and decapsulation in 2XX, the prior art
201 pairs of packets carry out sending packet to system CPU in the tunnel encapsulation process
The packet that 202 pairs of packets carry out after system CPU will encapsulate in the tunnel encapsulation process is returned to out processing queue
211 pairs of packets that have encapsulation header carry out sending packet to system CPU in the decapsulation process
The 212 pairs of packets that have an encapsulation header carry out the packet after with decapsulation of system CPU in the decapsulation process and are returned to out processing queue
The data field of 3X, packet
31 load territories, 32 packet heads, 33 tunnel encapsulation heads
Embodiment
With reference to figure 1, packet by tunnel encapsulation equipment 1, in general is that switch is handled before entering the tunnel and transmitting, and has added the tunnel encapsulation head; The based on network tunnel transmission of packet process that has added the tunnel encapsulation head is behind the other end in tunnel, be 401 shown in Fig. 1,402 processes, again through separating tunnel encapsulation equipment 1, it also is a switch, removed the tunnel encapsulation head, reverted to raw data packets and and then be transferred to the final destination.
In general, in said process, it is the switch with function of the same race that tunnel encapsulation equipment 1 is conciliate tunnel encapsulation equipment 1.
With reference to figure 2a, the form that adds tunnel encapsulation head raw data packets before is shown in Fig. 2 a, wherein packet head 32 comprises the address information of the final destination of this packet, and what load 31 parts were then represented this packet and transmitted will be by the data division of destination device processes.
With reference to figure 2b, the form that adds tunnel encapsulation head packet afterwards is shown in Fig. 2 b.Wherein, the information of tunnel encapsulation 33 is used for tunnel transmission, according to the packet after this information encapsulation by by the other end of tunnel transmission to the tunnel.
With reference to figure 3a, in existing solution, when raw data packets enter exchange chip 12 go into processing queue 121 after, go into the formation processing module after carrying out conventional treatment, send raw data packets to system CPU 11, promptly process 201, and system CPU 11 is transmitted back to out processing queue 122 after the tunnel encapsulation head is increased to raw data packets again, be process 202, the dequeue processing module packet that will have the tunnel encapsulation head is again sent out switch by the network port then.
With reference to figure 3b, in existing solution, when the encapsulation after packet enter exchange chip 12 go into processing queue 121 after, go into the formation processing module after carrying out conventional treatment, still the packet after will encapsulating sends system CPU 11 to, it is process 211, system CPU 11 is removed the tunnel encapsulation head and recover and raw data packets is transmitted back to out processing queue 122 after the raw data packets again, be process 212, the dequeue processing module is sent out switch with raw data packets by the network port after handling again then.
With reference to figure 4a, 4b, 5,6a, 6b, 6c, 6d, 6e, 7a, 7b, 7c, 7d one embodiment of the present of invention have been described jointly.
Shown in figure 4a, in switch provided by the present invention, increase the raw data packets of tunnel encapsulation head for needs, after it arrives processing queue 121, it is process 500, going into the formation processing module carries out after the conventional treatment this packet being sent into out processing queue 122 to this raw data packets, it is process 501, the dequeue processing module forms the tunnel encapsulation head and is increased on this packet then, the packet that will have the tunnel encapsulation head after disposing is sent into loop processing queue 123, be process 502, go into and once more it is sent into out processing queue 122 after the formation processing module is handled the packet in the loop processing queue 123 that promptly process 503; The dequeue processing module is sent switch with this packet by the network port to going out after the packet that has encapsulation header in the processing queue 122 is handled, and promptly process 504, and the described tunnel encapsulation packet that has finally transmits by the tunnel.
With reference to figure 5 and Fig. 6 a, Fig. 6 b, Fig. 6 c, Fig. 6 d, Fig. 6 e, it has specifically described above-mentioned processing procedure.Before handling beginning, go into processing queue 121, go out processing queue 122, the state of loop processing queue 123 shown in Fig. 6 a, any packet is not promptly arranged as yet.Arrive into processing queue 121 backs 600 in raw data packets, quene state is shown in Fig. 6 b.After handling beginning, at first, go into the formation processing module the next pending packet of going in the processing queue is carried out conventional treatment 601, after disposing packet is delivered to out in the processing queue, at this moment, quene state is shown in Fig. 6 c;
Go out the processing queue module then and judge whether to carry out tunnel encapsulation processing 602,, then it is delivered to out processing queue and the next pending packet that goes out in the processing queue is carried out conventional treatment 603 according to old process if do not need;
Go out the processing queue module above-mentioned packet is judged 604, carrying out tunnel encapsulation if desired handles, then go out the processing queue module and produce a tunnel encapsulation head according to this raw data packets header information, this encapsulation header is increased on the packet 609, and this packet delivered in the processing queue of loop 607, at this moment, quene state is shown in Fig. 6 d.
Above-mentioned to judge whether to carry out the process that tunnel encapsulation handles identical with usual manner of the prior art, and those skilled in the art can be achieved in conjunction with prior art, repeats no more.
Then, go into the formation processing module the next pending packet in the processing queue of loop is carried out conventional treatment 601.Because this packet has encapsulation header, thus this processing be based on new data packet head just the tunnel encapsulation header carry out.Go into the formation processing module and be checked through this packet and comprised the tunnel encapsulation header, just no longer it is carried out encapsulation process, but it is delivered to out processing queue 603, at this moment, quene state is shown in Fig. 6 e.
Then, the dequeue processing module is handled the next pending packet that goes out in the processing queue.Through judgement 604, comprised the tunnel encapsulation header based on this packet, the dequeue processing module is also no longer carried out encapsulation process to it, but it is sent out switch 605 from the network port, at this moment, and for example shown in Fig. 6 a, promptly this packet is processed finishes quene state.
Based on the tunnel encapsulation header of this packet, this packet is sent to the other end in tunnel by corresponding tunnel.
With reference to figure 4b, the other end in the tunnel, switch provided by the present invention is handled the packet that this has the tunnel encapsulation head.The packet that has a tunnel encapsulation head enter exchange chip 12 go into processing queue 121 after, go into and deliver to loop processing queue 123 after the formation processing module is taken out the tunnel encapsulation head with this packet, it is process 511, then, go into the formation processing module and again the packet that is arranged in loop processing queue 123 is carried out conventional treatment, deliver to out processing queue 122 after disposing, promptly process 512, after the dequeue processing module disposes this packet is sent out switch, promptly process 513.
Above-mentioned detailed process can specifically describe with reference to Fig. 5,7a, 7b, 7c, 7d.After switch received the packet that contains the tunnel encapsulation head by the tunnel, shown in Fig. 7 a, processing procedure began.At first, go into the formation processing module the next pending packet of going in the processing queue is carried out conventional treatment 601, after disposing, have tunnel encapsulation 602 if find this packet, then remove tunnel encapsulation that this packet comprises 606, and it is delivered to loop processing queue 607, at this moment, quene state is shown in Fig. 7 b; Otherwise, do not have tunnel encapsulation 602 if find this packet, then be sent to out and carry out conventional treatment 603 in the processing queue.
Then, go into the formation processing module the next pending packet in the processing queue of loop is carried out conventional treatment, find that after inspection it has not had the tunnel encapsulation head and has not promptly needed again it to be separated tunnel encapsulation processing 602, then use the raw data packets header information to continue this packet is carried out conventional treatment, deliver to out processing queue 603 after disposing, at this moment, quene state is shown in Fig. 7 c.
Then, the dequeue processing module is carried out conventional treatment to the next pending packet that goes out in the processing queue, find that after inspection this packet no longer needs to carry out tunnel encapsulation and handles 604, then final this packet is sent switch 610 based on initial data packet header by the network port, at this moment, quene state is shown in Fig. 7 d, and promptly received packet is processed to finish.
In above-mentioned steps 602,604, because processed packet is that switch receives from the tunnel, it should be sent to the destination of this packet correspondence by this switch, therefore, the dequeue processing module can not increase it tunnel encapsulation head once more and pass through tunnel transmission once more according to step 609 is described with it, but directly according to the address information in this packet this packet is sent to corresponding target ground.
In the above-described embodiments, hardware such as exchange chip are not made concrete selection, but this does not influence concrete enforcement of the present invention, those skilled in the art promptly can specifically implement the present invention in conjunction with the summary of the invention and the embodiment of foregoing description.For existing all-network switch system, just can both realize the function of existing switch system according to foregoing redesign back, realize again provided by the inventionly efficiently finishing the function that tunnel encapsulation is conciliate encapsulation process, thereby improve the operating efficiency of network switch system greatly by the loop.Equally, for exchange chip of the present invention, it also is according to realizing according to content of the present invention on the basis of the function of the existing exchange chip that is applied to the existing switch system, therefore, existing can be used for, all can redesign and realize the function of efficiently finishing tunnel encapsulation reconciliation encapsulation process by the loop of the present invention by content of the present invention with the collaborative exchange chip of handling in the tunnel of finishing of system CPU.
In another embodiment of the present invention, although require to use the tunnel encapsulation technology for those, but still wish to transmit with initial data header packet information rather than tunnel encapsulation header the system applies of packet, switch provided by the invention can be handled equally.In order to adapt to such processing, an option is provided in above-mentioned processing procedure, after the dequeue processing module is increased to the tunnel encapsulation head in the packet, can directly sends packet rather than deliver to once more the loop processing queue, thereby realize the requirement of similar system.In order to realize similar requirement, whether increase a data field 34 signs on can packet directly sends this packet, and on the basis of the embodiment shown in above-mentioned Fig. 4 a, before step 502 is carried out, increasing a step judges the above-mentioned identification data territory that comprises in the processed packet, if these data field 34 signs are directly sent switch, then directly send switch and get final product; Otherwise handle by still meeting the embodiment shown in Fig. 4 a.Correspondingly, on embodiment basis shown in Figure 5, before step 607 is carried out, also to correspondingly increase a step the above-mentioned identification data territory 34 that comprises in the processed packet is judged, if this data field sign is directly sent switch with this packet, then directly send switch and get final product; Otherwise by the process that still meets embodiment shown in Figure 5.
In the present embodiment, the composition of system and concrete processing procedure are not all described, and just will be described with a last embodiment difference, but those skilled in the art can realize present embodiment according to the description of a last embodiment and present embodiment.
According to processing method of the present invention with after configuration information is configured exchange chip of the present invention accordingly, switch system provided by the present invention just can be realized the process that the tunnel is handled under the situation that does not need system CPU to participate in, thereby can improve system handles efficient greatly.
Although the present invention is illustrated with aforesaid preferred embodiment, but the foregoing description is not to be used for limiting the present invention, any technical staff that this field is familiar with, enlightenment according to design philosophy of the present invention, concrete summary of the invention and embodiment, should various changes and adjustment, and by these changes with adjust resulting new content and should be contained by content of the present invention.