Summary of the invention
In view of above-mentioned analysis, the present invention aims to provide a kind of processing method and device of mixed service stream, flows the problem that the ratio in whole output bandwidth can not accurately dispose in order to solve the mixed service that exists in the prior art.
Purpose of the present invention mainly is achieved through the following technical solutions:
The invention provides the device that a kind of mixed service stream is handled, comprising: packet descriptor cache module, cpu i/f module, the pretreatment module of joining the team, speed limit module and the mapping block of joining the team, wherein,
Described packet descriptor cache module is used for the packet descriptor according to input port buffer memory mixed service stream;
The described pretreatment module of joining the team, be used for the type of packet descriptor being discerned, and data of different types bag descriptor carried out corresponding service handle back buffer memory respectively according to the packet descriptor of extracting from packet descriptor cache module;
Described speed limit module is used in the difference of output port configured bandwidth mixed service stream being carried out speed limit according to data of different types bag descriptor;
The described mapping block of joining the team is used for packet descriptor with the packet correspondence by speed limit module speed limit and is mapped to a plurality of formations and waits for scheduling output;
Described cpu i/f module is used for to the described pretreatment module of joining the team, speed limit module and the mapping block of joining the team configuration relevant information.
Further, described device also comprises:
Statistical module is used to add up the number of the packet descriptor that abandons and receive, and statistics is sent to described cpu i/f module.
Further, described packet descriptor cache module specifically comprises a plurality of descriptor buffer areas, and each descriptor buffer area is used for packet self the relevant descriptors information or the packet memory descriptor information of an input port of buffer memory.
Further, the described pretreatment module of joining the team specifically comprises: descriptor synthesis unit, preliminary treatment buffer unit and Service Processing Unit, wherein,
Described descriptor synthesis unit, be used for taking out packet self the relevant descriptors information of this input port and the packet memory descriptor symbol information of this input port, output to described preliminary treatment buffer unit after the packet descriptor of synthetic this input port according to input port;
Described preliminary treatment buffer unit is divided into a plurality of buffering areas according to the difference of type of service, and each buffering area is used to store one type packet descriptor;
Described Service Processing Unit is used for data of different types bag descriptor in each buffering area of preliminary treatment buffer unit is carried out corresponding service processing respectively.
Further, described descriptor synthesis unit specifically is used for, and takes out packet self the relevant descriptors information of this input port and the packet memory descriptor information of this input port according to input port, the packet descriptor of synthetic this input port; Judge whether that according to the abandoning indication in this packet descriptor needs abandon this packet then,, the packet descriptor of this packet correspondence is sent to carries out buffer memory in the preliminary treatment buffer unit for the packet that does not need to abandon.
Further, described speed limit module specifically is used for, according to the difference of packet configured bandwidth in each output port of different service types, by the mode of leaking bucket mixed service stream is carried out speed limit, the packet descriptor of the packet correspondence by leaking the bucket speed limit prepares to join the team mapping.
The method that the present invention also provides a kind of mixed service stream to handle comprises:
Steps A: according to the packet descriptor of input port buffer memory mixed service stream;
Step B: the type to the packet descriptor is discerned, and data of different types bag descriptor is carried out corresponding service handle back buffer memory respectively;
Step C: the difference according to data of different types bag descriptor configured bandwidth in output port is carried out speed limit to mixed service stream, and the packet descriptor of packet correspondence that will be by speed limit is mapped to and waits for scheduling output in a plurality of formations.
Further, described method also comprises:
Add up the number of the packet descriptor that abandons and receive, and statistics is exported.
Further, described packet descriptor comprises packet self relevant descriptors information and packet memory descriptor information, and described step B specifically comprises:
According to the packet descriptor of input port with packet self relevant descriptors information and synthetic this input port of packet memory descriptor information;
Data of different types bag descriptor after buffer memory synthesizes respectively;
Data of different types bag descriptor is carried out corresponding service processing respectively.
Further, described step C specifically comprises:
According to the difference of data of different types bag descriptor configured bandwidth in each output port, mixed service stream is carried out speed limit by the mode of leaking bucket;
The packet descriptor of packet correspondence that will be by leaking the bucket speed limit is mapped to waits for scheduling output in a plurality of formations.
Beneficial effect of the present invention is as follows:
Business Streams dissimilar among the present invention are handled through the speed limit of corresponding port respectively according to the output port under the packet after finishing the business processing flow of respective type; Have only the packet that has passed through the speed limit processing to send, otherwise just directly reclaim from corresponding ports.Adopt method of the present invention, when addressing the above problem, more can be according to user's demand, can the granularity of speed limit configuration be configured, be convenient to the allocated bandwidth of the dissimilar Business Stream of accurately control in port separately, the mixed service that so just can solve complexity flows the accurate ratio in whole output bandwidth.
Other features and advantages of the present invention will be set forth in the following description, and becoming apparent from specification of part perhaps understood by implementing the present invention.Purpose of the present invention and other advantages can realize and obtain by specifically noted structure in the specification of being write, claims and accompanying drawing.
Embodiment
The device and method that the object of the present invention is to provide a kind of mixed service stream to handle, carry out professional speed limit respectively at a plurality of output ports, mixed service packet in each port has only and has passed through speed limit and can be scheduled away, thereby reaches the purpose that the dissimilar ratio of mixed service stream in overall bandwidth accurately controlled.
Specifically describe the preferred embodiments of the present invention below in conjunction with accompanying drawing, wherein, accompanying drawing constitutes the application's part, and is used from explaination principle of the present invention with embodiments of the invention one.For clear and simplification purpose, when it may make theme of the present invention smudgy, with specifying in detail of known function and structure in the omission device described herein.
At first in conjunction with the accompanying drawings the described device of the embodiment of the invention is elaborated.
As shown in Figure 1, Figure 1 shows that the theory diagram of the described device of the embodiment of the invention, mainly comprise: packet descriptor cache module, cpu i/f module, the pretreatment module of joining the team, speed limit module, join the team mapping block and statistical module, wherein,
(1) packet descriptor cache module, main being responsible for according to the data cached bag descriptor of input port; Be exactly specifically, packet mainly is divided into two parts, and one is control flows, mainly comprises the packet descriptor; Another is a data flow, mainly is meant the content part of packet.In embodiments of the present invention, only relate to control flows, just packet descriptor part.The packet descriptor is from two aspects, and packet obtains packet self relevant descriptors information such as affiliated type of service of packet and packet attribute after analyzing through packet header on the one hand, gives in the input packet descriptor cache module as input; On the other hand, the content part of packet also needs to carry out corresponding buffer memory and management, and the packet memory descriptor information that obtains during storage (such as memory address etc.) is delivered to the packet information cache module as another input.Therefore, need in packet descriptor cache module, a plurality of descriptor buffer areas be set the quantity according to input port, the part of cache district is used for storing packet self relevant descriptors information, and another part buffer area is used for storing packet memory descriptor information.
For example shown in Figure 2, Fig. 2 is the schematic diagram according to the data cached bag descriptor of input port, suppose that mixed service stream includes clean culture, multicast, the packet of broadcasting and four kinds of types of service of inundation, and the mitigation Business Stream that includes four types of business more than setting is imported from 4 input ports (port one~port 4), then in packet descriptor cache module, need to be provided with 8 descriptor buffer areas, be respectively port one buffer area 1, port 2 buffer areas 2, port 3 buffer areas 3, port 4 buffer areas 4, port one buffer area 5, port 2 buffer areas 6, port 3 buffer areas 7, port 4 buffer areas 8, these 8 buffer areas are used for storing the packet descriptor of mixed service stream.
On the one hand, mixed service stream obtains packet self relevant descriptors information after analyzing through packet header, according to the difference of packet from port, leave in respectively in four descriptor buffer areas, such as, packet self relevant descriptors information from port one leaves port one buffer area 1 in, packet self relevant descriptors information from port 2 leaves port 2 buffer areas 2 in, packet self relevant descriptors information from port 3 leaves port 3 buffer areas 3 in, leaves port 4 buffer areas 4 in from packet self the relevant descriptors information of port 4.On the other hand, the content part of packet carries out corresponding buffer memory and management obtains packet memory descriptor information, leave in respectively in other four descriptor buffer areas, such as, packet memory descriptor information from port one leaves port one buffer area 5 in, packet memory descriptor information from port 2 leaves port 2 buffer areas 6 in, packet memory descriptor information from port 3 leaves port 3 buffer areas 7 in, leaves port 4 buffer areas 8 in from the packet memory descriptor information of port 4.
In the embodiment of the invention, descriptor buffer area 1 to 8 can adopt the form with FIFO (pushup storage) to realize, the degree of depth of each FIFO is 16.All descriptor buffer areas can not carry out abandoning of packet descriptor, packet self the relevant descriptors information that analysis obtains through the packet header data must be deposited in the descriptor buffer area 1 to 4 of corresponding port, handles the packet memory descriptor information that obtains through data pack buffer and must be deposited in the descriptor buffer area 5 to 8 of corresponding port.
(2) pretreatment module of joining the team, the main responsible packet descriptor of from packet descriptor cache module, extracting, according to the packet descriptor type of service under the packet is discerned, and the business processing flow of finishing type separately is deposited in the preliminary treatment buffer area of corresponding types business after handling;
The pretreatment module of joining the team specifically can comprise: descriptor synthesis unit, preliminary treatment buffer unit and Service Processing Unit, wherein,
The descriptor synthesis unit takes out packet self relevant descriptors information according to input port, and packet memory descriptor information, the packet descriptor of synthetic this input port.It should be noted that when two buffer areas that have only this input port correspondence are not empty the packet descriptor that just may synthesize this input port; For example shown in Figure 2, for port one buffer area 1 and port one buffer area 5, only at port one when not being empty to deserved buffer area 1 and buffer area 5, the packet descriptor that could synthesize port one, and the descriptor synthesis unit also will judge whether that needs abandon this packet descriptor according to the indication that abandons in the packet descriptor, for the packet descriptor that does not need to abandon, this packet descriptor is sent in the preliminary treatment buffer unit in the buffer area in the corresponding types according to the type of this packet descriptor.If when port one corresponding cache district 1 or 5 has one to be empty, just can not carry out the synthetic of packet information.The synthetic principle of the packet descriptor of port 2, port 3 and port 4 is identical with port one.
The preliminary treatment buffer unit is divided into a plurality of preliminary treatment buffer areas according to the difference of type of service, the packet descriptor that each preliminary treatment buffer area storage is a type.For example, packet descriptor for four types of clean culture, multicast, broadcasting and inundations, the preliminary treatment buffer unit just is divided into four memory blocks, be respectively clean culture preliminary treatment buffer area, multicast preliminary treatment buffer area, multicast preliminary treatment buffer area and inundation preliminary treatment buffer area, be used to store this packet descriptor of four types.
Service Processing Unit, take different Business Processing modes for the packet descriptor of different service types, specifically can adopt existing technical scheme to handle, such as, need carry out replication processes for the packet descriptor of multicast, broadcasting or inundation type.Unicast packet descriptor, multicast packet descriptor, broadcast data packet descriptor and the inundation packet descriptor finished behind the business processing flow separately enter the speed limit module.
(3) speed limit module, the main packet of being responsible at different output ports according to the difference of the packet of different service types band width configuration in output port separately, carries out speed limit according to predetermined policy.The packet descriptor of having only the packet correspondence of having passed through professional speed limit, can by and the map operation of joining the team.And, can adjust the configuration of speed limit in the embodiment of the invention, both can carry out speed limit to the type of packet, wrap in allocated bandwidth in the overall bandwidth to adjust data of different types, also can carry out speed limit at the priority of data of different types bag, like this at the basic enterprising step refining of type of data packet limit, can control each dissimilar priority datas more subtly and wrap in distribution in the output bandwidth.
For example, suppose to be provided with the words of four output ports, we can be according to the difference of user's request, output port 0 is carried out the setting of professional speed limit respectively by the cpu i/f module to output port 3, for example, for output port 0, the speed limit parameter of setting clean culture in the output port 0, multicast packets member, broadcast packet member and the inundation person of being bundled into is configured, thereby to clean culture, multicast packets member, broadcast packet member and the inundation person of the being bundled into accurate allocated bandwidth in output port 0.The professional speed limit function of output port 0 is here opened, clean culture in the output port 0, multicast packets member, broadcast packet member and the inundation person of being bundled into are carried out speed limit, have only the packet descriptor of the packet correspondence of having passed through output port 0 speed limit just can carry out next step formation map operation.Otherwise the packet descriptor of the packet correspondence by output port 0 does not just recycle.Similarly, also can carry out corresponding setting to output port 1, output port 2 and output port 3, the packet descriptor in each output port is finished corresponding leakage bucket speed limit and is handled.
Realize functionally that for speed limit can considering to adopt Lou in practice, the mode of bucket realizes.For leaking bucket, both can select single bucket that leaks, also can select two buckets that leak; For the configuration of leaking bucket, can adopt peak value to leak the mode of bucket speed limit, also can select mean value to leak the mode of bucket speed limit.Control leaking ladle capacity, filling time and fill rate, thereby be configured leaking the bucket granularity, be convenient to the allocated bandwidth of the dissimilar Business Stream of accurately control in output port separately, so just can realize the accurate control of dissimilar Business Streams in whole output bandwidth.As for the existing in the prior art ripe solution of the specific implementation process of leaking the bucket mode, do not do too much description herein.
Packet in port 0 service buffer district, port one service buffer district, port 2 service buffer districts and the port 3 service buffer districts, carry out formation mapping and other processing by certain scheduling strategy, and with the final information output of packet, thereby finish the entire process flow process.
(4) mapping block of joining the team, its major function is according to predetermined formation mapping principle, the packet descriptor of packet correspondences all in the different service types buffer area is mapped in the corresponding formation, so that the packet descriptor of same queue adopts the mode of formation to store and manage; Simultaneously, all packet descriptor also is scheduled away according to the order of input in formation separately and the partly synthetic complete packet of packet content of this packet descriptor correspondence.The mapping mode of formation can be searched the CPU module by formation mapped mode and the formation mapping table of cpu i/f module to its configuration.
(5) cpu i/f module, mainly be control information and the configuration data of accepting from the CPU module, the member's look-up table that comprises affiliated type of service such as the multicast of packet, broadcasting and inundation packet, formation mapped mode and formation mapping table, speed limit configuration information etc., and these control informations that will obtain and configuration data dispose respectively to the pretreatment module of joining the team, speed limit module and the mapping block of joining the team.For example, member's look-up table is disposed to the pretreatment module of joining the team, formation mapped mode and formation mapping table are disposed to the mapping block of joining the team, the speed limit configuration information is disposed to the speed limit module.In addition, the statistics of statistical module output can be read the module to CPU by the cpu i/f module, so that the CPU module is monitored the different types of data bag.
(6) port statistics module, as an optional functional module, the number of the packet descriptor of the different service types that the mainly responsible statistics of port statistics module abandons and receives, the number of the data of different types bag that also promptly abandons and receive; And the packets need of the packet descriptor correspondence that is dropped identifies the different types that abandons.In addition, for the discarded packets that produces at the preprocessing part of joining the team, the statistics that the port statistics module also is correlated with.The monitoring of different service types packet is strengthened in the effect of statistical module exactly, improves the measurability that mixed service flows down module.
Below in conjunction with accompanying drawing the described method of the embodiment of the invention is elaborated.
As shown in Figure 3, Fig. 3 is the schematic flow sheet of the described method of the embodiment of the invention, specifically can comprise the steps:
Step 1: packet descriptor cache module is according to buffer to ports packet descriptor;
Be exactly specifically, packet information mainly is divided into two aspects, and one is control flows, mainly comprises the packet descriptor; Another is a data flow, mainly is meant the content part of packet.In embodiments of the present invention, only relate to packet descriptor part.The packet descriptor is from two aspects, and packet is analyzed through packet header on the one hand, obtains packet self relevant descriptors information such as affiliated type of service of packet and packet attribute, gives in the input packet descriptor cache module as input; On the other hand, the data content of packet need carry out corresponding buffer memory and management, and the packet memory descriptor information that obtains during storage is delivered to the packet information cache module as another input.Therefore, need a plurality of buffer areas be set the quantity according to port in packet descriptor cache module, the part of cache district is used for storing packet self relevant descriptors information, and another part buffer area is used for storing packet memory descriptor information.
Step 2: the pretreatment module of joining the team is extracted the packet descriptor from packet descriptor cache module, according to the packet descriptor type of service under the packet is discerned, and the business processing flow of finishing type separately is deposited in the preliminary treatment buffer area of corresponding types business after handling;
Be exactly specifically, take out packet self relevant descriptors information according to input port, and packet memory descriptor information, the packet descriptor of synthetic this input port, judge whether that according to the indication that abandons in the packet descriptor needs abandon this packet then, if these data are packet discard, notification data packet data streams control section then, and the number of times of joining the team that packet is set is 0, point out that this packet is a packet discard, send this packet descriptor simultaneously back to, divide according to abandoning indication information by the packet data flow control part, finish the recovery that is dropped the shared data space of packet, the data space after the release will be distributed to use once more.If these data are not packet discard, then after receiving the packet descriptor, the type under the packet is discerned, according to the different service types of packet, packet is written in the buffer area of corresponding service type.Each type of service buffer area just as interim storage purposes, carries out the processing of the corresponding service type of packet descriptor then, leaves the packet descriptor of handling in the pairing buffer area of type separately.When packet is written to the data pack buffer district,, then directly abandon this packet if buffer area is full.It is duplicate that abandoning when concrete operations that buffer area FIFO completely abandons and packet are packet discard operated.
Step 3: the speed limit module is at the packet of different output ports, difference according to the packet of different service types band width configuration in output port separately, according to predetermined policy mixed service stream is carried out speed limit, the packet descriptor of having only the packet correspondence of having passed through professional speed limit, can by and the map operation of joining the team;
Be exactly specifically, finish the packet descriptor of each business processing flow, difference according to affiliated separately output port attribute, deliver to port separately respectively, the packet of mixed service stream is carried out the speed limit processing capacity according to the difference of the packet of different service types band width configuration in output port separately.Have only packet descriptor, can from corresponding output port, send, reach the purpose that service bandwidths different in each output port is controlled with this by the packet correspondence of leaking the bucket speed limit.
Realize functionally that for speed limit can considering to adopt Lou in practice, the mode of bucket realizes.For leaking bucket, both can select single bucket that leaks, also can select two buckets that leak; For the configuration of leaking bucket, can adopt peak value to leak the mode of bucket speed limit, also can select mean value to leak the mode of bucket speed limit.Control leaking ladle capacity, filling time and fill rate, thereby be configured leaking the bucket granularity, be convenient to the allocated bandwidth of the dissimilar Business Stream of accurately control in output port separately, so just can realize the accurate control of dissimilar Business Streams in whole output bandwidth.As for the existing in the prior art ripe solution of the specific implementation process of leaking the bucket mode, do not do too much description herein.
Packet descriptor for the packet correspondence of passing through speed limit, join the team mapping block according to predetermined formation mapping principle, packet descriptors all in the different service types buffer area is mapped in a plurality of formations, so that the packet of same queue adopts the mode of formation to store and manage.。Simultaneously, all packet descriptor also is scheduled away according to the order of input in formation separately and the partly synthetic complete packet of packet content of this packet descriptor correspondence.
The described method of the embodiment of the invention also comprises: the number of the packet descriptor of the different service types that port statistics module statistics abandons and receives also is the number of packet; And the packets need that is dropped identifies the different types that abandons.In addition, for the discarded packets that produces at the preprocessing part of joining the team, the statistics that the port statistics module also is correlated with.By the packet descriptor is added up the monitoring that can strengthen different service types packet descriptor, improve the measurability that mixed service flows down module.
What need further supplementary notes is, what adopt in the flow chart of Fig. 3 is handling process with the concurrent service type, also can adopt the mode of walking, after promptly whenever handling a pairing operation flow of packet descriptor, carry out the processing of next packet descriptor corresponding service flow process again according to certain strategy.The mode of serial process be fit to the less business flow processing of bandwidth ratio, and for the bigger Business Processing of bandwidth ratio, the mode of walking can not satisfy the requirement of processing, at this moment need improve the performance of processing in parallel mode.
In sum, the embodiment of the invention provides a kind of processing method and device of mixed service stream, can handle dissimilar Business Streams concurrently, in the performance that has promoted processing service flow, can be according to user's demand, business in each output port is carried out speed limit handle, be convenient to the allocated bandwidth of the dissimilar Business Stream of accurately control in output port separately, so just can realize the bandwidth ratio of dissimilar Business Streams in whole output bandwidth.
The above; only for the preferable embodiment of the present invention, but protection scope of the present invention is not limited thereto, and anyly is familiar with those skilled in the art in the technical scope that the present invention discloses; the variation that can expect easily or replacement all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection range of claims.