A kind of double-deck partition method of the Internet resources based on programmable switch
Technical field
The present invention relates to technical field of the computer network, relate in particular to a kind of double-deck partition method of the Internet resources based on programmable switch (Net Field Programmable Gate Array, NetFPGA).
Background technology
The Internet has been obtained huge success in the past few decades, the platform that it provides a brand-new exchange message, received information for people.Extensively popularizing of it promoted development and the application of network technology.Yet huge network has also limited its development in the future simultaneously.Such as, with scale and the size of current network, for each Network guarantees service quality very difficult.Traditional QoS implementation method is generally based on the model of Integration Services or Differentiated Services.Integration Services keeps independent resource for each business, but easily causes the wasting of resources; Differentiated Services is according to label flexible allocation resources such as priority, but the Internet resources that isolate for single business reservation.
The model of Integration Services and Differentiated Services respectively has superiority, but lacks flexibility, can't adapt to changeable network demand; On the other hand, the distribution method of Internet resources based on software simulation or theoretical the derivation, lacks concrete implementation method mostly at present.
Summary of the invention
The object of the invention is to for the deficiencies in the prior art, a kind of double-deck partition method of the Internet resources based on programmable switch is provided.
The objective of the invention is to be achieved through the following technical solutions: a kind of double-deck partition method of the Internet resources based on programmable switch comprises the following steps:
Step 1: packet enters programmable switch by one of 8 input ports: programmable switch has 8 input ports, comprises 4 1G ethernet ports and 4 DMA ports; Switch adopts polling mode to select packet to enter network layer from one of 8 input ports in turn;
Step 2: network layer protocol is selected the output port of packet according to routing table according to the packet head, and in output queue corresponding to packet head mark;
Step 3: use double-deck Internet resources partition method to mark the packet of output queue dispatch; This step realizes by following substep:
(3.1) obtain the stream number of packet: if be not with the VLAN label from the packet of network layer output, think that the stream number of this packet is 0; If the data band VLAN label from network layer output, use low its stream number of 2 bit-identifies of the VID field of VLAN: be not or not 00 packet is identified as flowing 0 with VLAN label or low 2 of VID, 2, VID end is that 01 packet is identified as flowing 1,2, VID end is that to be identified as flowing 2,2, VID end be that 03 packet is identified as flowing 3 for 02 packet;
(3.2) set up a scheduling queue for each stream, packet is sent into corresponding formation according to stream number;
(3.3) convection current is divided into groups, and one or more streams are combined into a conflux;
(3.4) use weighting round-robin mode to distribute the bandwidth of each conflux: establish the timeslice that a next round turns and add up to N, the nominated bandwidth of any one conflux i is b
i, total bandwidth is b, turning middle distribution timeslice in a next round for each conflux is b
i/ b * N; When taking turns to a conflux i acceptance service, all streams that its time will be belonged to conflux i use; When timeslice used, conflux i stopped the acceptance service, switched to next conflux and accepted service;
(3.5) within the service time that conflux i is assigned to, belong to the service time of each stream f according to the weight allocation of stream: the interior a plurality of streams of conflux are queued up and are accepted poll, for each stream arranges a balance counter; When a stream begins to receive service, according to the weight of this stream, add a difference (difference is directly proportional to the weight size) to the balance counter of this stream; For a stream that is being sent out, packet of every transmission, balance counter will reduce the byte number of this packet, when the difference counter be finished or the formation of this stream when empty, just switch to next stream; The increase of stream and minimizing can make the bandwidth that each stream obtains change, and make like this bandwidth in conflux to be taken full advantage of by the inner stream that exists;
(3.6) packet in certain formation is full of formation, and when having new data packets to enter this formation, this formation will abandon the oldest packet in this formation;
Step 4: the packet through scheduling enters output queue: programmable switch has 8 output ports, comprises 4 1G ethernet ports and 4 DMA ports; According to the output port mark that adds in step 2, send into specified queue.
The invention has the beneficial effects as follows, the present invention uses NetFPGA hardware device cheaply, realized flexible, the fair and controlled distribution of Internet resources, reduced the cost of realizing of Resource Allocation in Networks, its implementation is easy, means are flexible, and network service quality can significantly be guaranteed, and have nothing to do with network layer protocol.
Description of drawings
Fig. 1 is based on the double-deck partition method flow chart of the Internet resources of NetFPGA hardware.
Embodiment
The below describes the present invention with reference to the accompanying drawings in detail.
The present invention is based on the double-deck partition method of the Internet resources of programmable switch, comprise the following steps:
Step 1: packet enters programmable switch by one of 8 input ports.
Programmable switch has 8 input ports, comprises 4 1G ethernet ports and 4 DMA ports.Switch adopts polling mode to select packet to enter network layer from one of 8 input ports in turn.
Step 2: network layer protocol is selected the output port of packet according to routing table according to the packet head, and in output queue corresponding to packet head mark (for step 4).
Step 3: use double-deck Internet resources partition method to mark the packet of output queue dispatch.
This step is core of the present invention, is divided into following substep.
1) obtain the stream number of packet.
Each is from the packet of network layer output or not with VLAN label (think that stream number is 0 this moment) or with VLAN label (using low its stream number of 2 bit-identifies of the VID field of VLAN).Be not or not to be identified as flowing 2,0, VID end be that to be identified as flowing 2,1, VID end be that to be identified as flowing 2,2, VID end be that 03 packet is identified as flowing 3 for 02 packet for 01 packet for 00 packet with low 2 of VLAN label or VID.
2) set up a scheduling queue for each stream, packet is sent into corresponding formation according to stream number.
Formation can directly use the Core Generator software of match company of SEL (Xilinx) to utilize block storage (BRAM) resource on NetFPGA automatically to generate fifo queue on programmable switch.Packet is sent into corresponding formation.
3) convection current is divided into groups, and one or more streams are combined into a conflux.
4) use weighting round-robin mode to distribute the bandwidth of each conflux.
If the timeslice that a next round turns adds up to N, the nominated bandwidth of any one conflux i is b
i, total bandwidth is b, turning middle distribution timeslice in a next round for each conflux is b
i/ b * N.
When taking turns to a conflux i acceptance service, all streams that its time will be belonged to conflux i use; When timeslice used, conflux i stopped the acceptance service, switched to next conflux and accepted service.By this method, each conflux is accepted the time of service and can clearly be specified, and like this, the bandwidth of single conflux just can be guaranteed.
5) within the service time that conflux i is assigned to, belong to the service time of each stream f according to the weight allocation of stream.Here use classical difference polling method.The interior a plurality of streams of conflux are queued up and are accepted poll, for each stream arranges a balance counter (Deficit Counter).When a stream begins to receive service, according to the weight of this stream, add a difference (difference is directly proportional to the weight size) to the balance counter of this stream.For a stream that is being sent out, packet of every transmission, balance counter will reduce the byte number of this packet, when the difference counter be finished or the formation of this stream when empty, just switch to next stream.The increase of stream and minimizing can make the bandwidth that each stream obtains change, and make like this bandwidth in conflux to be taken full advantage of by the inner stream that exists.
Double-deck structure makes this method not only can adapt to for example requirement of the strict allocated bandwidth of virtual net (by distributing a conflux to each virtual net), also can adapt to the demand according to the weight allocation bandwidth simultaneously.
6) packet in certain formation is full of formation, and when having new data packets to enter this formation, this formation will abandon the oldest packet in this formation.
Step 4: the packet through scheduling enters output queue.
Programmable switch has 8 output ports, comprises 4 1G ethernet ports and 4 DMA ports.According to the output port mark that adds in step 2, send into specified queue.