QoS (Quality of Service) is a concept
generally existing in occasions with service supply and demand. It evaluates
the ability to meet the need of the customers in service. Generally, the
evaluation is not to grade precisely. Its purpose is to analyze the conditions
when the service is the best and the conditions when the service still needs
improvement and then to make improvements in the specified aspects.
In internet, QoS
evaluates the ability of the network to deliver packets. The evaluation on QoS
can be based on different aspects because the network provides various
services. Generally speaking, QoS is the evaluation on the service ability to
support the core requirements such as delay, delay variation and packet loss
ratio in the packet delivery.
Traffic means
service traffic, that is, all the packets passing the switch.
Traffic classification means to identify
packets conforming to certain characters according to certain rules.
A classification rule is a filter rule
configured to meet your management requirements. It can be very simple. For
example, you can use a classification rule to identify traffic with different
priorities according to the ToS field in the IP packet header. It can be very
complicated too. For example, you can use a classification rule to identify the
packets according to the combination of link layer (Layer 2), network layer
(Layer 3) and transport layer (Layer 4) information including MAC addresses, IP
protocols, source addresses, destination addresses, the port numbers of
applications and so on.
Classification is
generally based on the information in the packet header and rarely based on the
packet content.
1)
IP precedence, ToS precedence and DSCP
precedence

Figure 1-1 DS fields and TOS bytes
The TOS field in an IP header contains 8
bits:
l
The first three bits indicate IP precedence in
the range of 0 to 7.
l
Bit 3 to bit 6 indicate ToS precedence in the
range of 0 to 15.
l
RFC2474 re-defines the ToS field in the IP
packet header, which is called the DS field. The first six (bit 0 to bit 5)
bits of the DS field indicate DSCP precedence in the range of 0 to 63.The first
three bits in DSCP precedence are class selector codepoints, bit 4 and bit 5
indicate drop precedence, and bit 6 is zero indicating that the device sets the
service class with the DS model.
l
The last two bits (bit 6 and bit 7) are reserved
bits.
The precedence
values of the IP packet indicate 8 different service classes.
Table 1-1 Description on IP Precedence
|
IP Precedence (decimal)
|
IP Precedence (binary)
|
Description
|
|
0
|
000
|
routine
|
|
1
|
001
|
priority
|
|
2
|
010
|
immediate
|
|
3
|
011
|
flash
|
|
4
|
100
|
flash-override
|
|
5
|
101
|
critical
|
|
6
|
110
|
internet
|
|
7
|
111
|
network
|
The Diff-Serv network defines four traffic
classes:
l
Expedited Forwarding (EF) class: In this class,
packets can be forwarded regardless of link share of other traffic. The class
is suitable for preferential services with low delay, low packet loss ratio,
low variation and assured bandwidth (such as virtual leased line);
l
Assured forwarding (AF) class: This class is
further divided into four subclasses (AF1/2/3/4) and a subclass is further
divided into three drop priorities, so the AF service level can be segmented.
The QoS rank of the AF class is lower than that of the EF class;
l
Class selector (CS) class: This class comes from
the IP TOS field and includes 8 classes;
l
Best Effort (BE) class: This class is a special
class without any assurance in the CS class. The AF class can be degraded to
the BE class if it exceeds the limit. Current IP network traffic belongs to
this class by default.
Table 1-2 Description on DSCP values
|
Keyword
|
DSCP value (decimal)
|
DSCP value (binary)
|
|
ef
|
46
|
101110
|
|
af11
|
10
|
001010
|
|
af12
|
12
|
001100
|
|
af13
|
14
|
001110
|
|
af21
|
18
|
010010
|
|
af22
|
20
|
010100
|
|
af23
|
22
|
010110
|
|
af31
|
26
|
011010
|
|
af32
|
28
|
011100
|
|
af33
|
30
|
011110
|
|
af41
|
34
|
100010
|
|
af42
|
36
|
100100
|
|
af43
|
38
|
100110
|
|
cs1
|
8
|
001000
|
|
cs2
|
16
|
010000
|
|
cs3
|
24
|
011000
|
|
cs4
|
32
|
100000
|
|
cs5
|
40
|
101000
|
|
cs6
|
48
|
110000
|
|
cs7
|
56
|
111000
|
|
default (be)
|
0
|
000000
|
2)
802.1p priority
802.1p priority lies in Layer 2 packet
headers and is applicable to occasions where the Layer 3 packet header does not
need analysis but QoS must be assured in Layer 2.

Figure 1-2 An Ethernet frame with a 802.1Q tag header
As shown in the figure above, each host
supporting 802.1Q protocol adds a 4-bit 802.1Q tag header after the source
address of the former Ethernet frame header when sending packets.
The 4-bit 802.1Q tag header contains a
2-bit Tag Protocol Identifier (TPID) whose value is 8100 and a 2-bit Tag
Control Information (TCI). TPID is a new class defined by IEEE to indicate a
packet with an 802.1Q tag. Figure 1-3 describes
the detailed contents of an 802.1Q tag header.

Figure 1-3
802.1Q tag headers
In the figure above, the 3-bit priority
field in TCI is 802.1p priority in the range of 0 to 7.The 3 bits specify the precedence
of the frame.8 classes of precedence are used to determine which packet is sent
preferentially when the switch is congested.
Table 1-3 Description on 802.1p priority
|
IP Precedence (decimal)
|
IP Precedence (binary)
|
Description
|
|
0
|
000
|
best-effort
|
|
1
|
001
|
background
|
|
2
|
010
|
spare
|
|
3
|
011
|
excellent-effort
|
|
4
|
100
|
controlled-load
|
|
5
|
101
|
video
|
|
6
|
110
|
voice
|
|
7
|
111
|
network-management
|
The precedence is called 802.1p priority because the related
applications of this precedence are defined in detail in the 802.1p
specification.
3)
Local precedence
Local precedence is the precedence of an
outbound queue on a port of the switch. It is in the range of 0 to 7. Each outbound
queue has its own local precedence.
Protocol packets carry their own priority.
You can perform QoS actions on protocol packets by setting their priorities.
The priority remark function
is to use ACL rules in traffic identification and remark the priority for the
packets matching with the ACL rules.
Packet filter means filtering the service
traffic. For example, in the operation of dropping packets, the service traffic
matching with the traffic classification rule is dropped and the other traffic
is permitted. The Ethernet switch adopts a complicated traffic classification
rule to filter the packets based on much information and to drop these useless,
unreliable, and doubtful packets. Therefore, the network security is enhanced.
The two critical steps in the packet filter
operation are:
Step1: Classify the inbound packets to the
port by the set classification rule.
Step 2: Perform the
filter——drop operation on the classified packets.
The packet filter function can be
implemented by applying ACL rules on the port. Refer to the description in the ACL
module for detailed configurations.
Rate limit on ports is port-based rate
limit. It limits the total rate of outbound packets on a port.
The network will be made more congested by
plenty of continuous burst packets if the traffic of each user is not limited.
The traffic of each user must be limited in order to make better use of the
limited network resources and provide better service for more users. For
example, the traffic can only get its committed resources in an interval to
avoid network congestion caused by excess bursts.
TP (traffic
policing) is a kind of traffic control policy to limit the traffic and its
resource usage by supervising the traffic specification. The regulation policy
is implemented according to the evaluation result on the premise of knowing
whether the traffic exceeds the specification when TP or TS is performed. The
token bucket is generally adopted in the evaluation of traffic specification.
I. Traffic evaluation
and the token bucket
The token bucket can be considered as a
container with a certain capacity to hold tokens. The system puts tokens into
the bucket at the set rate. When the token bucket is full, the extra tokens
will overflow and the number of tokens in the bucket stops increasing.

Figure 1-4 Evaluate the traffic with the
token bucket
1)
Evaluate the traffic with the token bucket
The evaluation for the traffic specification
is based on whether the number of tokens in the bucket can meet the need of
packet forwarding. If the number of tokens in the bucket is enough to forward
the packets (generally, one token is associated with a 1-bit forwarding
authority), the traffic is conforming to the specification, and otherwise the
traffic is nonconforming or excess.
When the token bucket evaluates the
traffic, its parameter configurations include:
l
Average rate: The rate at which tokens are put
into the bucket, namely, the permitted average rate of the traffic. It is
generally set to committed information rate (CIR).
l
Burst size: The capacity of the token bucket,
namely, the maximum traffic size that is permitted in every burst. It is
generally set to committed burst size (CBS). The set burst size must be bigger
than the maximum packet length.
One evaluation is performed on each
arriving packet. In each evaluation, if the number of tokens in the bucket is
enough, the traffic is conforming to the specification and you must take away
some tokens whose number is corresponding to the packet forwarding authority;
if the number of tokens in the bucket is not enough, it means that too many
tokens have been used and the traffic is excess.
2)
Complicated evaluation
You can set two token buckets in order to
evaluate more complicated conditions and implement more flexible regulation
policies. For example, TP includes 4 parameters:
l
CIR
l
CBS
l
Peak information rate (PIR)
l
Excess burst size (EBS)
Two token buckets are used in this
evaluation. Their rates of putting tokens into the buckets are CIR and PIR
respectively, and their sizes are CBS and EBS respectively (the two buckets are
called C bucket and E bucket respectively for short), representing different
permitted burst levels. In each evaluation, you can implement different
regulation policies in different conditions, including “enough tokens in
C bucket”, “insufficient tokens in C bucket but enough tokens in E
bucket” and “insufficient tokens in both C bucket and E bucket”.
II. TP
The typical application of TP is to
supervise the specification of certain traffic into the network and limit it
within a reasonable range, or to punish the extra traffic. Therefore, the
network resources and the interests of the operators are protected. For
example, you can limit HTTP packets within 50% of the network bandwidth. If the
traffic of a certain connection is excess, TP can choose to drop the packets or
to reset the priority of the packets.
TP is widely used in policing the traffic
into the network of internet service providers (ISP).TP can classify the
policed traffic and perform pre-defined policing actions according to different
evaluation results. These actions include:
l
Forward: Forward the packet whose evaluation
result is “conforming” or mark DSCP precedence for Diff-Serv
packets and then forward them.
l
Drop: Drop the packet whose evaluation result is
“nonconforming”.
l
Modify the precedence and forward: Modify the
priority of the packets whose evaluation result is
“partly-conforming” and forward them.
l
Enter the next-rank policing: TP can be piled up
rank by rank and each rank polices more detailed objects.
1.1.9
Redirect
You can re-specify the forwarding port of
packets as required by your own QoS policy.
When the network is congested, the problem
that many packets compete for resources must be solved, usually in the way of
queue scheduling.
In the following section, strict priority
(SP) queues and weighted round robin (WRR) queues are introduced.
1)
SP queue

Figure 1-5 Diagram for SP queues
SP queue-scheduling algorithm is specially
designed for critical service applications. An important feature of critical
services is that they demand preferential service in congestion in order to
reduce the response delay. Assume that there are 8 output queues on the port
and the preferential queue classifies the 8 output queues on the port into 8
classes, which are queue7, queue6, queue5, queue4, queue3, queue2, queue1, and
queue0. Their priorities decrease in order.
In the queue scheduling, SP sends packets
in the queue with higher priority strictly following the priority order from
high to low. When the queue with higher priority is empty, packets in the queue
with lower priority are sent. You can put critical service packets into the
queues with higher priority and put non-critical service (such as e-mail)
packets into the queues with lower priority. In this case, critical service
packets are sent preferentially and non-critical service packets are sent when
critical service groups are not sent.
The disadvantage of
SP queue is that: if there are packets in the queues with higher priority for a
long time in congestion, the packets in the queues with lower priority will be
“starved to death” because they are not served.
2)
WRR queue

Figure 1-6 Diagram for WRR
3)
WRR queue-scheduling algorithm schedules all the
queues in turn and every queue can be assured of a certain service time. Assume
there are 8 priority queues on the port. WRR configures a weight value for each
queue, which are w7, w6, w5, w4, w3, w2, w1, and w0. The weight value indicates
the proportion of obtaining resources. On a 100M port, configure the weight
value of WRR queue-scheduling algorithm to 50, 50, 30, 30, 10, 10, 10 and 10
(corresponding to w7, w6, w5, w4, w3, w2, w1, and w0 in order). In this way,
the queue with the lowest priority can get 5Mbps bandwidth at least, and the
disadvantage of SP queue-scheduling that the packets in queues with lower
priority may not get service for a long time is avoided. Another advantage of
WRR queue is that: though the queues are scheduled in order, the service time
for each queue is not fixed, that is to say, if a queue is empty, the next
queue will be scheduled. In this way, the bandwidth resources are made full use
of.
1.1.11
Traffic-based Traffic Statistics
The function of
traffic-based traffic statistics is to use ACL rules in traffic identifying and
perform traffic statistics on the packets matching with the ACL rules. You can
get the statistics of the packets you are interested in through this function.
When congestion is too serious, the switch
can adopt the random early detection (RED) algorithm to solve the problem of
excessive congestion and avoid global TCP synchronization caused by the
tail-drop algorithm.
In the RED algorithm, an upper limit and a
lower limit are set for each queue, and it is stipulated that:
l
When the queue length is smaller than the lower
limit, packets are not dropped.
l
When the queue length is bigger than the upper
limit, all inbound packets all dropped.
l
When the queue length is in the range of the
upper limit and the lower limit, the inbound packets are dropped at random. In
this case, a number is assigned to each inbound packet and then compared with
the drop probability of the current queue. If the number is bigger than the drop
probability, the inbound packet is dropped. The longer a queue is, the higher
the drop probability is. However, there is a top drop probability.
In the RED algorithm, packets are dropped
at random so that global TCP synchronization is avoided. When packets in a TCP
connection are dropped and sent at a low rate, packets in other TCP connections
are still sent at a high rate. In this way, packets in a part of connections
are sent at a high rate in any case. Thus, the utilization rate of bandwidth is
improved.
1.2 QoS Supported by S7500
Table 1-4 QoS functions supported by
S7500 and related commands
|
QoS
|
Specification
|
Related command
|
|
Priority mapping
|
Support only the mapping between 802.1p
priority and local queues
|
qos cos-local-precedence-map
|
|
Port priority
|
—
|
priority priority-level
|
|
Priority to be used when a packet enters
a queue
|
—
|
priority-trust
|
|
TP
|
—
|
traffic-limit
|
|
Priority remark
|
—
|
traffic-priority
|
|
Redirect
|
—
|
traffic-redirect
|
|
Queue scheduling
|
Support SP, RR and WRR
|
queue-scheduler
|
|
Rate limit
|
—
|
line-rate
|
|
Bandwidth assurance
|
—
|
traffic-bandwidth
|
|
Congestion avoidance
|
RED operation
|
traffic-red
|
|
Traffic statistics
|
Supported
|
traffic-statistic
|
|
Inbound CAR
|
—
|
inboundcar
{ enable | disable }
|
|
Traffic-based flexible QinQ
|
—
|
traffic-remark-vlanid inbound acl-rule [ system-index ] remark-vlan
vlan-id
|
1.3 Setting Port Priority
If an inbound packet is not VLAN-tagged, the
switch will tag the packet with the default VLAN of the port receiving the
packet. In this case, the port priority of the port receiving the packet is
assigned to the 802.1p priority of the VLAN tag of the packet. In this case,
you can set the port priority.
If the inbound packet is VLAN-tagged, the
switch does not perform the operation above.
I. Configuration
prerequisites
l
The port whose priority is to be configured is
specified
l
The priority value of the specified port is
specified
II. Configuration
procedure
Table 1-5 Set to use the port priority
|
Operation
|
Command
|
Description
|
|
Enter system view
|
system-view
|
—
|
|
Enter Ethernet port view
|
interface interface-type
interface-number
|
—
|
|
Set the port priority
|
priority priority-level
|
Optional
By default, the port priority is 0
|
III. Configuration
example
l
Set the port priority of Ethernet 1/0/1 to 7.
Configuration procedure:
<H3C> system-view
System View: return to User View with
Ctrl+Z.
[H3C] interface gigabitEthernet1/0/1
[H3C-GigabitEthernet1/0/1] undo
priority-trust cos
[H3C-GigabitEthernet1/0/1] priority 7
l
Set the switch to use the 802.1p priority
carried in the packet on Ethernet1/0/1.
Configuration procedure:
<H3C> system-view
System View: return to User View with
Ctrl+Z.
[H3C] interface Ethernet1/0/1
[H3C-Ethernet1/0/1] priority trust
When congestion occurs in the network,
queue scheduling is generally adopted to solve the problem that multiple packets
compete for resources.
A port of the switch supports eight output
queues. The priority of each queue is different, and packets in the queue with
higher priority are sent preferentially. The switch puts a packet into the
corresponding queue according to the DSCP precedence, IP precedence, 802.1p
priority or local precedence of the packet. The mapping relationship between
precedence values and queues are shown in Table 1-6,
Table 1-7, Table 1-8,
and Table 1-9.
Table 1-6 The mapping relationship
between the 802.1p priority values and queues
|
802.1p priority
|
Queue
|
|
0
|
2
|
|
1
|
0
|
|
2
|
1
|
|
3
|
3
|
|
4
|
4
|
|
5
|
5
|
|
6
|
6
|
|
7
|
7
|
Table 1-7 The mapping relationship
between the local precedence values and queues
|
Local precedence
|
Queue
|
|
0
|
0
|
|
1
|
1
|
|
2
|
2
|
|
3
|
3
|
|
4
|
4
|
|
5
|
5
|
|
6
|
6
|
|
7
|
7
|
Table 1-8 The mapping relationship
between IP precedence values and queues