The method of interface drive repeating procedure of routerThe present invention relates to the driving method of router repeating process, specifically, relate to a kind of method that router interface drives forward efficiency in transmission and the receiving course that improves.
Exchanges data action between the network that router is responsible for being associated as the visual plant of network interconnection process promptly realizes the reception and the transmission of data between network of relation.In the middle of this, router comprises the general processing procedure of data: router receives the data that this network transmits from the port of a network, specifically, receive as the physical layer of interface single plate in the router and processing said data after, processed data are sent to data link layer in the router as packet; This packet of data link layer deals, packet after will handling then is sent to network protocol layer, carry out that described packet is carried out Routing Protocol and handle, find the destination address of this packet, will be recycled to described data link layer again through the as above packet of multistep treatment again; Data link layer is handled again by the packet that can send, and be recycled to it again after handling again and state physical layer, physical layer is as internetwork transmission interface, the data of above-mentioned processing is sent to another network of relation from its port, thereby realizes that data are in internetwork transmission.
Said process can be as shown in Figure 1, and the part among the figure in the dotted line is represented the interface section of router.
As can be seen from Figure 1, the router interface veneer is responsible for the transmission and the reception of data.Interface drives the efficient of the efficient direct relation router forwarding of transmitting.In transmission and receiving course that general interface drives, if it is busy (for example: common serial port module on the general router) to run into hardware, then think retransmission failure, stop the processing of this packet, the termination physical process is: under the transmission situation, if it is busy to run into hardware, return failure then for the upper strata call function, interface sends function and no longer does other processing, stops this transmission.Under reception condition, if it is busy to run into hardware, then abandons this and receive data, receiver function is no longer done other processing, stops this reception.If it is busy to run into hardware in process of transmitting, then resend later on by upper layer software (applications); If it is busy to run into hardware in receiving course, then abandon the packet of this reception.For example, the common serial port module of general router generally comes the hardware in the processing forward process busy according to said process.Though the processing method of this prior art has advantages such as simple, reliable, its distinct disadvantage is that the forward efficiency of this router interface is not high.
The objective of the invention is the improvement made at the shortcoming of general processing method, a kind of method of controlling interface drive repeating procedure of router is provided, the efficient that interface shown in can improving is transmitted.
For achieving the above object, the present invention proposes a kind of method of interface drive repeating procedure of router, may further comprise the steps:
Set up the transmission and the receiving cache queue of the pending data of storage respectively at the router port place;
When hardware is not busy by driver with the data forwarding in the buffer queue.
Wherein, transmission and receiving cache queue are the first in first out buffer queues.
Adopt the method for interface drive repeating procedure of router of the present invention, can or send buffer queue storage data, do not wait that the data of transmitting processing are terminated or abandon and do not make, thereby improve internetwork data forwarding efficient by receiving cache queue.Compare with the data forwarding process of prior art router, adopt the data forwarding efficient of the router of control method of the present invention to improve about 20%.
By specific embodiment the method for interface drive repeating procedure of router of the present invention is described in further detail below in conjunction with accompanying drawing, wherein:
Fig. 1 is the forwarding process figure that the prior art router data connects/sends;
Fig. 2 is the forwarding process figure of a kind of embodiment of explanation interface drive repeating procedure of router control method of the present invention.
Fig. 2 is the forwarding process figure of an embodiment of interface drive repeating procedure of router method of the present invention, may further comprise the steps;
Receiving cache queue is handled and is waited to transmit packet and service data bag sign (S1), simultaneously, whether judge router hardware " hurrying " (S2), and when being judged as " doing ", then deposit this packet to be transmitted in described receiving cache queue (S3), if and judgement hardware " is not in a hurry ", then start hardware forwarding capability (S4), realization makes data deliver to the physical layer of router through receiving cache queue by driver, and pass through data link layer and network protocol layer in the router successively, and reverse path, the transmission buffer queue forwarding data through linking to each other with the router transmit port, be the step S5 shown in Fig. 2, thereby finish repeating process.
Receiving cache queue described in the present embodiment and transmission are received buffer queue and be can be " first in first out priority buffer queue ".Transmission and receiving cache queue are priority queue.For High Density Interface module (promptly on an interface module a plurality of interfaces being arranged), the priority of distinct interface can be different (connecting Very Important Person such as some interface).The priority of different passages can be set by the configuration of routers administrative staff.When running into hardware in the repeating process when busy, correspondence is transmitted the channel number of passage and the priority of this passage deposits formation in as a record.When hardware is not busy, check the first in first out priority queue, at first handle the high passage of level of priority; When priority is identical, handle each passage with equal priority by the principle of first in first out.After certain passage disposes, the record deletion of this channel number correspondence.
The detection whether channel hardware " hurries " is that the mode by communication controler corresponding registers state on the fetch interface module realizes.Before each the forwarding, all must at first read the buffer status of corresponding communication controler, if state is " spare time ", then directly starts and transmit; If state is " hurrying ", then the method for describing according to this patent deposits respective channel in the first in first out priority queue, waits pending.
Therefore the difference of method of the present invention and prior art processing method is: prior art Processing method be to run into the hardware busy to stop this transmission or reception ﹠ disposal, be judged as this time transmission Or take defeat, and processing method of the present invention is when running into hardware and " hurrying ", does not stop this time Send or reception ﹠ disposal, but the data of processing to be sent or to be received are put into the team that arranges respectively In the row,, data are sent or the receiving course processing by interface driver software again when " spare time " at hardware Complete.
Consider the busy just temporary transient phenomenon of hardware, in the sending and receiving process, if run into Hardware is busy, and is not equal to the sending and receiving failure. Set up respectively if pending data are put into Receiving cache queue and transmission buffer queue are transmitted described buffering by driver again in the hardware idle Data in the formation. So that so mode can be correct with running into the busy data of hardware in the repeating process Ground is transmitted, avoided process of transmitting at the middle and upper levels software repeating transmission and in receiving course, abandon number According to bag.