Understanding Priority Mapping
Priority Mapping
Packets carry different types of precedence field depending on the network type. For example, packets carry the 802.1p field in a VLAN network, the EXP field on an MPLS network, and the DSCP field on an IP network. The mapping between the priority fields must be configured on the gateway to retain packet priorities when the packets traverse different types of networks.
The priority mapping mechanism provides the mapping from precedence fields of packets to internal priorities (local priorities) or the mapping from internal priorities to precedence fields of packets. This mechanism uses a DiffServ domain to manage and record the mapping between precedence fields and Class of Service (CoS) values. When a packet reaches the device, the device maps the priority in the packet or the default 802.1p priority of the inbound interface to a local priority. The device then determines which queue the packet enters based on the mapping between internal priorities and queues, and performs traffic policing, queuing, and scheduling. In addition, the device can re-mark precedence fields of outgoing packets so that the downstream device can provide differentiated QoS based on packet priorities.
Precedence Fields
Certain fields in the packet header or frame header record QoS information so that network devices can provide differentiated services. These fields include:
Precedence field
The 8-bit Type of Service (ToS) field in an IP packet header contains a 3-bit IP precedence field. Figure 2-1 shows the Precedence field in an IP packet.
Bits 0 to 2 constitute the Precedence field, representing precedence values 7, 6, 5, 4, 3, 2, 1 and 0, in descending order of priority. The highest priorities (values 7) are reserved for routing and network control communication updates. User-level applications can use only priority values 0 to 5.
Apart from the Precedence field, a ToS field also contains the following sub-fields:
Bit D indicates the delay. The value 0 represents a normal delay and the value 1 represents a short delay.
Bit T indicates the throughput. The value 0 represents normal throughput and the value 1 represents high throughput.
Bit R indicates the reliability. The value 0 represents normal reliability and the value 1 represents high reliability.
DSCP field
RFC initially defined the ToS field in IP packets and later added bit C that indicates the monetary cost. Then, the IETF DiffServ Working Group redefined bits 0 to 5 of a ToS field in an IPv4 packet as the DSCP field in RFC. In RFC, the field name is changed from ToS to differentiated service (DS). Figure 2-1 shows the DSCP field in packets.
In the DS field, the first six bits (bits 0 to 5) are the DS CodePoint (DSCP) and the last two bits (bits 6 and 7) are reserved. The first three bits (bits 0 to 2) are the Class Selector CodePoint (CSCP), which represents the DSCP type. A DS node selects a Per-Hop Behavior (PHB) based on the DSCP value.
802.1p priority in the Ethernet frame header
Layer 2 devices exchange Ethernet frames. As defined in IEEE 802.1Q, the PRI field (802.1p priority) in the Ethernet frame header, also called CoS, identifies the QoS requirement. Figure 2-2 shows the PRI field.
The 802.1Q header contains a 3-bit PRI field. The PRI field defines eight service priority values 7, 6, 5, 4, 3, 2, 1 and 0, in descending order of priority.
MPLS EXP field
In contrast to IP packets, MPLS packets use labels. A label has 4 bytes. Figure 2-3 shows the format of the MPLS EXP field.
The Label field contains four sub-fields:Label: contains 20 bits and specifies the next hop to which a packet is to be forwarded.
EXP: contains 3 bits and is reserved for extensions; also known as the CoS field.
S: contains 1 bit and identifies the last entry in the label stack. MPLS supports hierarchical labels. If the S sub-field is 1, the label is at the bottom of the stack.
TTL: contains 8 bits and is the same as the Time to Live (TTL) in IP packets.
The EXP field is used as the CoS field in MPLS packets and is equivalent to the ToS field in IP packets. The EXP field is used to differentiate data flows on MPLS networks. The EXP field encodes eight transmission priorities 7, 6, 5, 4, 3, 2, 1 and 0 in descending order of priority.
On an IP network, the IP precedence or DSCP field in an IP packet identifies the CoS value. On an MPLS network, a Label Switching Router (LSR) cannot identify IP packet headers; therefore, EXP fields are marked at the edge of the MPLS network.
By default, the IP precedence in an IP packet is copied to the EXP field in an MPLS packet at the edge of an MPLS network. If an ISP does not trust a user network or differentiated service levels defined by an ISP are different from those on a user network, reconfigure the EXP field in an MPLS packet based on classification policies and internal service levels. During forwarding on the MPLS network, the ToS field in an IP packet remains unchanged.
On an MPLS network, intermediate nodes classify packets based on the EXP field in MPLS packets and perform PHBs such as congestion management, traffic policing, and traffic shaping.