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. If packets traverse different types of networks, the mapping between the priority fields must be configured on the gateway. This configuration ensures that the packet priorities are retained regardless of network type.
The priority mapping mechanism maps the precedence fields of packets to internal priorities (local priorities) and, conversely, maps the 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. Upon receipt of a packet, 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
As defined in RFC 791, the 8-bit Type of Service (ToS) field in an IP packet header contains a 3-bit IP precedence field. Figure 4-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 and 6) are reserved for routing and network control communication updates. User-level applications can use only priority values 0 to 5.
In addition to 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.
Bits 6 and 7 represent the Explicit Congestion Notification (ECN) field.
DSCP field
RFC 1349 initially defined the ToS field in IP packets and later added bit C, which indicates the monetary cost. Subsequently, the IETF DiffServ Working Group redefined bits 0 to 5 of a ToS field as the DSCP field in RFC 2474. In RFC 2474, the field name is changed from ToS to differentiated service (DS). Figure 4-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, also called CoS) in the Ethernet frame header identifies the QoS requirement. Figure 4-2 shows the PRI field.
The 802.1Q header contains a 3-bit PRI field and a 1-bit CFI field. The PRI field defines eight service priority values 7, 6, 5, 4, 3, 2, 1, and 0, in descending order of priority. The CFI field defines the drop priority of packets.
MPLS EXP field
In contrast to IP packets, MPLS packets use labels. A label has 4 bytes. Figure 4-3 shows the format of the MPLS EXP field.
The EXP 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. It differentiates 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. However, 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.