Summary of the invention
The purpose of this invention is to provide a kind of aggregated links dispatching method and data forwarding device, to overcome the existing big defective of queue scheduling module resource amount that expends based on the virtual port mapping.
For addressing the above problem, the invention provides a kind of aggregated links dispatching method based on the virtual port mapping, be applied to comprise in the data forwarding device:
When queue scheduling is carried out in said aggregated links formation, the virtual port that the most said aggregated links of bag descriptor classification of data to be transmitted bag in the said aggregated links is distributed is waited for out team.
Further, said method also comprises:
In the mapping channel in empty tag maps to each member port of said aggregated links of said virtual port buffer memory;
Wherein, said mapping channel is the spatial cache of any priority except that the spatial cache of limit priority and lowest priority in the said member port.
Further, said method also comprises:
When a certain member port is scheduled; Wait for out team if judge in the spatial cache that priority is higher than said mapping channel bag; And there is bag to wait for out team in the said mapping channel, then from the corresponding virtual port, takes out a bag descriptor, and export out team's scheduling.
Further, said method also comprises:
After said bag descriptor is taken out from said virtual port; The full situation of sky according to current said virtual port buffer memory; The sky sign of the said virtual port buffer memory of corresponding renewal, and should sky sign correspondence be updated on the sky sign of mapping channel of each corresponding member port of said virtual port.
Further, said method also comprises:
With the corresponding packet of bag descriptor in preserve out the member port number of team;
Bag descriptor in virtual port is scheduled out after the team, exports from corresponding member port according to the member port of storing in the packet number packet that said bag descriptor is corresponding.
Correspondingly, the present invention also provides a kind of data forwarding device, comprising: the queue scheduling module;
Comprise memory cell and scheduling unit in the said queue scheduling module;
Said memory cell is used for the bag descriptor of store aggregated link queue data to be transmitted bag;
The queue scheduling unit is used for when queue scheduling is carried out in said aggregated links formation, and the virtual port that the most said aggregated links of said bag descriptor classification is distributed is waited for out team.
Further, also comprise in the said queue scheduling module:
Map unit is used in the mapping channel with each member port of the empty tag maps of said virtual port buffer memory to said aggregated links;
Wherein, said mapping channel is the spatial cache of any priority except that the spatial cache of limit priority and lowest priority in the said member port.
Further, also comprise in the said queue scheduling module:
Go out group scheduling unit; Be used for when a certain member port is scheduled, wait for out team if judge in the spatial cache that priority is higher than said mapping channel bag, and have bag to wait for out team in the said mapping channel; Then from the corresponding virtual port, take out a bag descriptor, and export out team's scheduling.
Further, also comprise in the said queue scheduling module:
Updating block; Be used for after said bag descriptor is taken out from said virtual port; The full situation of sky according to current said virtual port buffer memory; The sky sign of the said virtual port buffer memory of corresponding renewal, and should sky sign correspondence be updated on the sky sign of mapping channel of each corresponding member port of said virtual port.
Further, also comprise in the said device: go out group module;
With the corresponding packet of bag descriptor in preserve out the member port number of team;
Saidly go out group module and be used for bag descriptor at virtual port and be scheduled out after the team, export from corresponding member port according to the member port of storing in the packet number packet that said bag descriptor is corresponding.
The present invention has used virtual port, divides time-like at polymerization formation bag descriptor, need number not classify according to member port, has therefore saved the resource of a large amount of storage member port numbers.In addition, can also guarantee that the strict priority between member port protocol queue and the virtual port common queue concerns.
Embodiment
For making the object of the invention, technical scheme and advantage clearer, hereinafter will combine accompanying drawing that embodiments of the invention are elaborated.Need to prove that under the situation of not conflicting, embodiment among the application and the characteristic among the embodiment be combination in any each other.
In the present embodiment, a kind of aggregated links dispatching method based on the virtual port mapping, as shown in Figure 2, comprising:
In the queue scheduling module, increase virtual port definitions, be every aggregated links and distribute a virtual port number; When the aggregated links formation was scheduled, the bag descriptor of this aggregated links was not to be classified to its member port separately, waited for out team but be classified to this aggregated links corresponding virtual port.Therefore, need not in the queue scheduling module corresponding member port of each bag of storage number, can save a large amount of storage resources like this.
The first step that goes out team's scheduling is to select suitable port.If virtual port and common port merged participate in poll, the phenomenon that possibly exist the protocol queue bandwidth of member port to be seized by the common queue of virtual port.To this problem, in the present embodiment, need the member port of virtual port to the aggregated links of correspondence be shone upon.As shown in Figure 3; To comprise 6 physical ports in the scheduling structure and 2 virtual ports are example; Virtual port 0 is corresponding to physical port 0, physical port 1 and physical port 2 being bundled the aggregated links that the back is set up; Virtual port 1 is corresponding to the aggregated links that physical port 4 and physical port 5 binding backs are set up, and physical port 3 is not participated in link aggregation.The formation of each physical port is divided into three priority, is respectively Pr0~Pr2.
Virtual port is the process that virtual port is mapped to simultaneously all member ports of its corresponding aggregated links to the physical port mapping.No matter virtual port still is a physical port all need be used for the bag descriptor that storage queue is dispatched out according to the certain spatial cache of priority independent allocation.The spatial cache of each priority safeguards that all an empty sign is used to judge whether its affiliated port has bag to wait for out team.In this device; Virtual port is to the process of all member ports mapping of its corresponding aggregated links, be with each member port that maps to its corresponding aggregated links from the empty sign of virtual port in real time except that the spatial cache of limit priority and minimum top grade the process on the sky sign of the spatial cache of any priority.Hereinafter, the spatial cache of the sky sign that is mapped with virtual port on the member port is abbreviated as the mapping channel of this virtual port.As shown in Figure 3, priority is that the spatial cache of Pr1 is the mapping channel of virtual port 0 on the physical port 0~2, and in like manner, the spatial cache that last priority is Pr1 on the physical port 4 and 5 is the mapping channel of virtual port 1.Because of the sky sign of virtual port need map to a plurality of physical ports simultaneously; So in the time of need changing at the sky sign of virtual port; This sky sign is updated to simultaneously on the sky sign of mapping channel in its each member port, as the poll condition that goes out team's scheduling port.
When going out team's scheduling, the poll of port is to physical port.Because the sky sign of each virtual port all is mapped on the mapping channel of all member ports; Therefore; As long as there is bag to wait for out team in this member port corresponding virtual port, the mapping channel on this member port just is in non-dummy status, and this member port just possibly be selected.
Though physical port maybe be as the member port of aggregated links; But still there is the protocol queue of high priority in itself; These formations all should preferentially go out team under any condition; Therefore after a certain physical port is selected, at first should be according to priority order from high to low, judge that successively this physical port medium priority is higher than in the buffer memory of mapping channel and whether has bag to wait for out team.If have, then from the high buffer memory of this priority, take out a bag descriptor, export out team's scheduling then.
If this physical port medium priority is higher than in the buffer memory of mapping channel all bag and waits for out team; Whether then judge has bag to wait for out team's (whether the value of promptly judging the sky sign of this mapping channel is non-NULL) in this mapping channel; Wait for out team if judged bag; Then from the corresponding virtual port, take out a bag descriptor, and export out team's scheduling.
There is bag to wait for out under the prerequisite of team at this physical port; If judge also not wrap in the mapping channel in this physical port and wait for out team; Then inevitable priority is lower than in the buffer memory of this mapping channel has bag to wait for out team; Take out a bag descriptor in the buffer memory of low priority accordingly this moment from this physical port, and export out team's scheduling.
After the bag descriptor was removed, whether had bag wait for out team, and the empty sign of its buffer memory of corresponding renewal if need rejudge this bag descriptor place port, prevent the air-conditioning degree.If this bag descriptor that goes out team's scheduling takes out from virtual port; Whether the buffer memory that then need rejudge virtual port is empty; Upgrade the sky sign of this virtual port buffer memory in view of the above; And should sky sign correspondence be updated in the sky sign of the mapping channel on all corresponding member ports of this virtual port, completion this time goes out team's scheduling.
Owing to from virtual port is dispatched out the bag descriptor of team, do not go out the member port number of team, therefore need in the corresponding data bag, store member's port numbers.In data forwarding device; Packet is stored in outer DDR (the Double Data Rate of sheet; The Double Data Rate synchronous DRAM) buffer memory, when packet is read from cache module, this device according to the member port of storing in this packet number with current data packet from this member port output.
Describe and can know through preceding text:
At first; The present invention increases the bag descriptor that virtual port is used for the store aggregated link when going out group; Need not when queue scheduling, will wrap descriptor is classified to its each member port and waits for out team; Wait for out team but be classified under the corresponding virtual port, therefore can save the resource of storage member port numbers;
Secondly; Physical port is after being tied to aggregated links, and also there is protocol queue in its port inside, and the queue priority in the virtual port should be lower than the protocol queue priority of its member port; Therefore when going out team's scheduling; Can not virtual port and physical port merging be carried out polling operation, otherwise possibly cause aggregated links common queue message to seize the protocol queue bandwidth of member port, cause losing of physical port protocol massages.After adopting the present invention; Being lower than limit priority and being higher than on the buffer memory of middle priority of lowest priority empty tag maps to each member port of virtual port; And do not participate in the poll of physical port, can guarantee the strict priority relation between the common message of member port protocol massages and virtual port.
With structure as shown in Figure 3, further specify aggregated links dispatching method based on the virtual port mapping, as shown in Figure 4, may further comprise the steps:
S301: carry out the polling operation of physical port, from physical port, select to have bag to wait for out the port of team, port itself has bag to wait for out that team or port have bag to wait for out that team all can be selected as its corresponding virtual port of member port;
S302: whether to the port of selecting in the S301 step, judging in the buffer memory of its priority P r0 has bag to wait for out team; Wait for out team if any bag, then carry out S303; Otherwise, carry out S305;
S303: from the Pr0 buffer memory, take out a bag descriptor, wait for output;
Whether after S304: step S303 is complete, needing to judge in the Pr0 buffer memory is empty, and its empty sign of corresponding renewal; Execution in step S314 then;
S305: judge whether to wrap in the Pr1 buffer memory and wait for out team; If have, then carry out S306; Otherwise, carry out S312;
S306: judge and work as whether front port is the member port of aggregated links; If, execution in step S307 then; Otherwise, carry out S310;
S307: from the virtual port of this aggregated links, take out a bag descriptor and wait for out team;
After S308: step S307 carries out and finishes, need to judge whether this aggregation port buffer memory is empty, and upgrade its empty sign;
S309: because the sky sign of aggregation port buffer memory need be mapped in its corresponding member port, therefore in step S308, upgrade in the empty sign, need sky sign refresh all with all member port Pr1 buffer memorys of this aggregated links; Carry out S314 then;
S310: from this port Pr1 buffer memory, take out a bag descriptor and wait for out team;
After S311: step S310 is complete, need to judge whether the Pr1 buffer memory is empty, and its empty sign of corresponding renewal; Execution in step S314 then;
S312: must have bag to wait for out team by the Pr2 buffer memory this moment, then from the Pr2 buffer memory, takes out a bag descriptor and wait for out team;
After S313: step S312 is complete, need to judge whether the Pr2 buffer memory is empty, and its empty sign of corresponding renewal;
S314: accomplish this and go out group scheduling flow.
Can know according to above-mentioned flow process; After having selected physical port; No matter whether this physical port has participated in link aggregation; Whether all preferentially judge in the buffer memory of limit priority Pr0 of current physical port has bag to wait for out team, so no matter whether this physical port has participated in link aggregation, can both guarantee to work as front port limit priority encapsulate priority scheduling.
When in certain physics port, having 3 priority; If this physical port has been participated in link aggregation; Its Pr1 buffer memory mapping channel that must be this port then; Therefore after in having judged the Pr1 buffer memory of current physical port, having bag to wait for out team, need judge also whether current cache is the mapping channel of virtual port.When having bag to wait for out group in the virtual port; The mapping channel of its all member ports all should be designated non-NULL; Therefore when the sky sign of virtual port buffer memory takes place to upgrade; Should refresh simultaneously to the sky sign of the Pr1 buffer memory of its all member ports, embody the mapping relations of virtual port and General Physics port.
After poll goes out physical port; If judge in the time of going out team's scheduling to the corresponding aggregated links of this physical port; Need be according to the mapping relations of virtual port and physical port; Take out a bag descriptor to the corresponding virtual port, also embodied the mapping relations of virtual port and General Physics port.
In addition, in the present embodiment, a kind of data forwarding device comprises: the queue scheduling module;
Comprise memory cell and scheduling unit in the said queue scheduling module;
Said memory cell is used for the bag descriptor of store aggregated link queue data to be transmitted bag;
The queue scheduling unit is used for when queue scheduling is carried out in said aggregated links formation, and the virtual port that the most said aggregated links of said bag descriptor classification is distributed is waited for out team.
Preferably, also comprise in the said queue scheduling module:
Map unit is used in the mapping channel with each member port of the empty tag maps of said virtual port buffer memory to said aggregated links;
Wherein, said mapping channel is the spatial cache of any priority except that the spatial cache of limit priority and lowest priority in the said member port.
Preferably, also comprise in the said queue scheduling module:
Go out group scheduling unit; Be used for when a certain member port is scheduled, wait for out team if judge in the spatial cache that priority is higher than said mapping channel bag, and have bag to wait for out team in the said mapping channel; Then from the corresponding virtual port, take out a bag descriptor, and export out team's scheduling.
Preferably, also comprise in the said queue scheduling module:
Updating block; Be used for after said bag descriptor is taken out from said virtual port; The full situation of sky according to current said virtual port buffer memory; The sky sign of the said virtual port buffer memory of corresponding renewal, and should sky sign correspondence be updated on the sky sign of mapping channel of each corresponding member port of said virtual port.
Preferably, also comprise in the said device: go out group module;
With the corresponding packet of bag descriptor in preserve out the member port number of team;
Saidly go out group module and be used for bag descriptor at virtual port and be scheduled out after the team, export from corresponding member port according to the member port of storing in the packet number packet that said bag descriptor is corresponding.
One of ordinary skill in the art will appreciate that all or part of step in the said method can instruct related hardware to accomplish through program, said program can be stored in the computer-readable recording medium, like read-only memory, disk or CD etc.Alternatively, all or part of step of the foregoing description also can use one or more integrated circuits to realize.Correspondingly, each the module/unit in the foregoing description can adopt the form of hardware to realize, also can adopt the form of software function module to realize.The present invention is not restricted to the combination of the hardware and software of any particular form.
The above is merely the preferred embodiments of the present invention, is not to be used to limit protection scope of the present invention.According to summary of the invention of the present invention; Also other various embodiments can be arranged; Under the situation that does not deviate from spirit of the present invention and essence thereof, those of ordinary skill in the art are when making various corresponding changes and distortion according to the present invention, and are all within spirit of the present invention and principle; Any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.