Invention content
The object of the present invention is to provide a kind of aggregated links dispatching method based on virtual port mapping and data forwarding dresses
It sets, with the defect for overcoming existing consuming queue scheduling module resource amount big.
To solve the above problems, the present invention provides a kind of aggregated links dispatching method based on virtual port mapping, answer
For in data forwarding device, including:
When carrying out queue scheduling to the aggregated links queue, the packet of data to be transmitted packet in the aggregated links is retouched
The virtual port for stating the most described aggregated links distribution of symbol classification waits for out team.
Further, the method further includes:
The empty mark that the virtual port caches is mapped to the mapping channel in each member port of the aggregated links
In;
Wherein, the mapping channel be spatial cache in the member port except highest priority and lowest priority it
The spatial cache of outer arbitrary priority.
Further, the method further includes:
When a certain member port is scheduled, if judging priority higher than not having in the spatial cache of the mapping channel
Packet waits for out team, and has packet to wait for out team in the mapping channel, then a packet descriptor is taken out from corresponding virtual port,
And export out team's scheduling.
Further, the method further includes:
After the packet descriptor is taken out from the virtual port, the sky according to presently described virtual port caching is full
Situation accordingly updates the empty mark that the virtual port caches, and sky mark is corresponded to and is updated to the virtual port correspondence
Each member port mapping channel empty mark on.
Further, the method further includes:
The member port number of team is preserved out in data packet corresponding with packet descriptor;
Packet descriptor in virtual port is scheduled out after team, will be described according to the member port number stored in data packet
The corresponding data packet of packet descriptor is exported from corresponding member port.
Correspondingly, the present invention also provides a kind of data forwarding devices, including:Queue scheduling module;
Include storage unit and queue scheduling unit in the queue scheduling module;
The storage unit is used to store the packet descriptor of data to be transmitted packet in aggregated links queue;
Queue scheduling unit is used to, when carrying out queue scheduling to the aggregated links queue, the packet descriptor be classified
The virtual port of the most described aggregated links distribution waits for out team.
Further, further include in the queue scheduling module:
Map unit, the empty mark for caching the virtual port map to each member port of the aggregated links
In mapping channel in;
Wherein, the mapping channel be spatial cache in the member port except highest priority and lowest priority it
The spatial cache of outer arbitrary priority.
Further, further include in the queue scheduling module:
Go out group scheduling unit, for when a certain member port is scheduled, priority to be logical higher than the mapping if judging
Team is waited for out without packet in the spatial cache in road, and has packet to wait for out team in the mapping channel, then from corresponding virtual port
One packet descriptor of middle taking-up, and export out team's scheduling.
Further, further include in the queue scheduling module:
Updating unit is used for after the packet descriptor is taken out from the virtual port, according to presently described virtual
The sky of buffer to ports expires situation, accordingly updates the empty mark of the virtual port caching, and sky mark correspondence is updated to institute
It states on the empty mark of the mapping channel of the corresponding each member port of virtual port.
Further, further include in described device:Go out group module;
The member port number of team is preserved out in data packet corresponding with packet descriptor;
It is described go out group module be scheduled out after team for packet descriptor in virtual port, according to what is stored in data packet
Member port number exports the corresponding data packet of the packet descriptor from corresponding member port.
Present invention uses virtual port, when polymerizeing the classification of queue packet descriptor, need not according to member port number into
Row classification, therefore save the resource of a large amount of storage member port number.Moreover it is possible to ensure member port protocol queue and void
Strict priority relationship between quasi- port common queue.
Specific implementation mode
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with attached drawing to the present invention
Embodiment be described in detail.It should be noted that in the absence of conflict, in the embodiment and embodiment in the application
Feature mutually can arbitrarily combine.
In the present embodiment, a kind of aggregated links dispatching method based on virtual port mapping, as shown in Fig. 2, including:
In queue scheduling module, increase virtual port definitions, as every aggregated links distributes a virtual port number;
When aggregated links queue is scheduled, the packet descriptor of the aggregated links is not classified to its respective member port instead of,
It is classified to the corresponding virtual port of the aggregated links and waits for out team.It is therefore not necessary to store each packet in queue scheduling module
Corresponding member port number can save a large amount of storage resource in this way.
The first step for going out team's scheduling is to select suitable port.If virtual port and common port are merged and participate in wheel
It askes, it is understood that there may be the phenomenon that protocol queue bandwidth of member port is seized by the common queue of virtual port.For this problem,
In the present embodiment, need to map virtual port to the member port of corresponding aggregated links.As shown in figure 3, with scheduling
Comprising for 6 physical ports and 2 virtual ports in structure, virtual port 0 correspond to physical port 0, physical port 1 and
The aggregated links that physical port 2 is established after being bundled, virtual port 1 correspond to after physical port 4 and the binding of physical port 5
The aggregated links of foundation, physical port 3 are not engaged in link aggregation.The queue of each physical port is divided into three preferentially
Grade, respectively Pr0~Pr2.
Virtual port to Physical ports map be by virtual port and meanwhile be mapped to its corresponding aggregated links it is all at
The process of member port.No matter virtual port or physical port are required to independently distribute certain spatial cache according to priority,
The packet descriptor dispatched out for storage queue.The spatial cache of each priority all safeguards an empty mark for judging belonging to it
Whether port has packet to wait for out team.In the present apparatus, virtual port is mapped to all member ports of its corresponding aggregated links
Process, be will from each member port that virtual port sky mark maps to its corresponding aggregated links in real time except highest it is excellent
Process except the spatial cache of first grade and minimum top grade on the empty mark of the spatial cache of arbitrary priority.Hereinafter, will
The spatial cache that the empty mark of virtual port is mapped on member port is referred to as the mapping channel of the virtual port.Such as Fig. 3 institutes
Showing, the spatial cache that priority is Pr1 on physical port 0~2 is the mapping channel of virtual port 0, similarly, physical port 4 and 5
The spatial cache that upper priority is Pr1 is the mapping channel of virtual port 1.Because the empty mark of virtual port need to map to simultaneously
Multiple physical ports, so need when the empty mark of virtual port changes, which is indicated while being updated to Qi Gecheng
In member port on the empty mark of mapping channel, as the polling conditions for going out team's scheduling port.
When carrying out out team's scheduling, the poll of port is for physical port.Since the empty mark of each virtual port is equal
It is mapped on the mapping channel of all member ports, therefore, as long as thering is packet to wait for out in the corresponding virtual port of the member port
Team, the mapping channel on the member port are just in non-null states, which may be selected.
Although physical port itself may still have the agreement of high priority as the member port of aggregated links
Queue, these queues all should preferentially go out team in any condition, therefore after a certain physical port is selected, first should be according to
The sequence of priority from high to low judges priority is higher than in the caching of mapping channel whether have packet etc. in the physical port successively
Team to be gone out.If so, then taking out a packet descriptor from the high caching of the priority, team's scheduling is then exported out.
If priority waits for out team higher than in the caching of mapping channel without packet in the physical port, judge that this is reflected
Whether have packet wait for out team (judge whether the value of the empty mark of the mapping channel be non-empty), if it is judged that having if penetrating in channel
Packet waits for out team, then a packet descriptor is taken out from corresponding virtual port, and exports out team's scheduling.
Under the premise of the physical port has packet to wait for out team, if it is judged that in mapping channel in the physical port
It does not wrap and waits for out team, then inevitable priority in the caching of the mapping channel less than having packet to wait for out team, at this time from the physics end
A packet descriptor is taken out in the caching of corresponding low priority in mouthful, and exports out team's scheduling.
After packet descriptor is removed, need whether port where rejudging the packet descriptor has packet to wait for out team, and
The empty mark of its caching is accordingly updated, air-conditioning degree is prevented.If this packet descriptor for going out team's scheduling is taken out from virtual port
, then whether the caching for needing to rejudge virtual port is empty, updates the empty mark of virtual port caching accordingly, and should
Sky mark is corresponding to be updated in the empty mark of the mapping channel on the corresponding all member ports of the virtual port, and completion this time goes out
Team dispatches.
The member port number of team is not gone out in packet descriptor due to dispatching out team from virtual port, it is therefore desirable in correspondence
Member port number is stored in data packet.In data forwarding device, data packet be stored in the outer DDR of piece (Double Data Rate,
Double Data Rate synchronous DRAM) caching, when data packet is read from cache module, the device is according in the data packet
The member port number of storage exports current data packet from the member port.
By above description:
First, the present invention increases the packet descriptor that virtual port is used to store aggregated links when going out group, without in queue
Packet descriptor is classified to its each member port when scheduling and waits for out team, but is classified under corresponding virtual port and waits for out
Team, therefore the resource of storage member port number can be saved;
Secondly, physical port is after being tied to aggregated links, there is also protocol queue inside port, in virtual port
Queue priority should be less than the protocol queue priority of its member port, therefore when carrying out out team's scheduling, cannot be by virtual terminal
Mouth and physical port, which merge, carries out polling operation, and aggregated links common queue message otherwise may be caused to seize the association of member port
Queue bandwidth is discussed, the loss of physical port protocol massages is caused.After applying the present invention, the empty mark of virtual port is mapped to respectively
On the caching of the middle priority less than highest priority and higher than lowest priority of a member port, and it is not involved in physics end
The poll of mouth, can guarantee the strict priority relationship between member port protocol massages and the common message of virtual port.
With structure as shown in Figure 3, the aggregated links dispatching method mapped based on virtual port, such as Fig. 4 are further illustrated
It is shown, include the following steps:
S301:The polling operation for executing physical port selects have the port that packet waits for out team, port sheet from physical port
Body has packet to wait for out team or port, and as member port, its corresponding virtual port has packet to wait for out team that can be selected;
S302:For the port selected in S301 steps, judge whether there is packet to wait for out in the caching of its priority P r0
Team;Team is waited for out if any packet, then executes S303;Otherwise, S305 is executed;
S303:A packet descriptor is taken out from Pr0 cachings, is waited to be output;
S304:After the completion of step S303 is executed, need to judge in Pr0 cachings whether to be empty, and accordingly update its sky mark;
Then step S314 is executed;
S305:Judge to wait for out team either with or without packet in Pr1 cachings;If so, then executing S306;Otherwise, S312 is executed;
S306:Judge present port whether be aggregated links member port;If so, thening follow the steps S307;Otherwise,
Execute S310;
S307:A packet descriptor is taken out from the virtual port of the aggregated links waits for out team;
S308:After step S307 is executed, need to judge whether aggregation port caching is empty, and update its sky mark
Will;
S309:Since the empty mark of aggregation port caching need to be mapped in its corresponding member port, in step
While updating empty mark in S308, the empty mark refresh all for caching all member port Pr1 of the aggregated links is needed;
Then S314 is executed;
S310:A packet descriptor, which is taken out, from port Pr1 cachings waits for out team;
S311:After the completion of step S310 is executed, need to judge whether Pr1 cachings are empty, and accordingly update its sky mark;So
Step S314 is executed afterwards;
S312:At this time must Pr2 be cached with packet and wait for out team, then taking out a packet descriptor from Pr2 cachings waits for out
Team;
S313:After the completion of step S312 is executed, need to judge whether Pr2 cachings are empty, and accordingly update its sky mark;
S314:It completes this and goes out group scheduling flow.
According to above-mentioned flow it is found that after having selected physical port, no matter whether the physical port takes part in link aggregation,
Whether there is packet to wait for out team in the caching of all preferential highest priority Pr0 for judging current physical port, so no matter the physics
Whether port takes part in link aggregation, can ensure the coating priority scheduling of the highest priority of present port.
There are when 3 priority in certain physical port, if the physical port takes part in link aggregation, Pr1 is slow
Deposit must be the port mapping channel, therefore judged current physical port Pr1 caching in there is packet to wait for out team after, also
Need to judge current cache whether be virtual port mapping channel.When there is packet to wait for out group in virtual port, it is all at
The mapping channel of member port should all be identified as non-empty, therefore when the empty mark of virtual port caching updates, should brush simultaneously
On the empty mark newly cached to the Pr1 of its all member port, the mapping for having embodied virtual port and General Physics port is closed
System.
After poll goes out physical port, if it is decided that team's scheduling should be carried out out to the corresponding aggregated links of the physical port
When, the mapping relations according to virtual port and physical port are needed, take out a packet descriptor to corresponding virtual port, also body
The mapping relations of virtual port and General Physics port are revealed.
In addition, in the present embodiment, a kind of data forwarding device, including:Queue scheduling module;
Include storage unit and queue scheduling unit in the queue scheduling module;
The storage unit is used to store the packet descriptor of data to be transmitted packet in aggregated links queue;
Queue scheduling unit is used to, when carrying out queue scheduling to the aggregated links queue, the packet descriptor be classified
The virtual port of the most described aggregated links distribution waits for out team.
Preferably, further including in the queue scheduling module:
Map unit, the empty mark for caching the virtual port map to each member port of the aggregated links
In mapping channel in;
Wherein, the mapping channel be spatial cache in the member port except highest priority and lowest priority it
The spatial cache of outer arbitrary priority.
Preferably, further including in the queue scheduling module:
Go out group scheduling unit, for when a certain member port is scheduled, priority to be logical higher than the mapping if judging
Team is waited for out without packet in the spatial cache in road, and has packet to wait for out team in the mapping channel, then from corresponding virtual port
One packet descriptor of middle taking-up, and export out team's scheduling.
Preferably, further including in the queue scheduling module:
Updating unit is used for after the packet descriptor is taken out from the virtual port, according to presently described virtual
The sky of buffer to ports expires situation, accordingly updates the empty mark of the virtual port caching, and sky mark correspondence is updated to institute
It states on the empty mark of the mapping channel of the corresponding each member port of virtual port.
Preferably, further including in described device:Go out group module;
The member port number of team is preserved out in data packet corresponding with packet descriptor;
It is described go out group module be scheduled out after team for packet descriptor in virtual port, according to what is stored in data packet
Member port number exports the corresponding data packet of the packet descriptor from corresponding member port.
One of ordinary skill in the art will appreciate that all or part of step in the above method can be instructed by program
Related hardware is completed, and described program can be stored in computer readable storage medium, such as read-only memory, disk or CD
Deng.Optionally, all or part of step of above-described embodiment can also be realized using one or more integrated circuits.Accordingly
Ground, the form that hardware may be used in each module/unit in above-described embodiment are realized, the shape of software function module can also be used
Formula is realized.The present invention is not limited to the combinations of the hardware and software of any particular form.
The foregoing is only a preferred embodiment of the present invention, is not intended to limit the scope of the present invention.According to
The invention content of the present invention, can also there is other various embodiments, without deviating from the spirit and substance of the present invention, be familiar with
Those skilled in the art makes various corresponding change and deformations in accordance with the present invention, all in the spirit and principles in the present invention
Within, any modification, equivalent replacement, improvement and so on should all be included in the protection scope of the present invention.