Packets of different types have different priorities. For example, 802.11 packets sent by STAs carry user priorities or DSCP priorities, VLAN packets on wired networks carry 802.1p priorities, and IP packets carry DSCP priorities. Priority mapping must be configured on network devices to retain the priorities of packets that traverse different networks.
The 8-bit ToS field in an IP packet header contains a 3-bit IP precedence field, as shown in Figure 2.
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.
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.
RFC 1349 initially defined the ToS field in IP packets and added bit C. Bit C indicates the monetary cost. Later, 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 2 shows the DSCP field in packets.
In the DS field, the first six bits (bits 0 to 5) are the DS Code Point (DSCP) and the last two bits (bits 6 and 7) are reserved. The first three bits (bits 0 to 2) are the Class Selector Code Point (CSCP), which represents the DSCP type. A DS node selects a Per-Hop Behavior (PHB) based on the DSCP value.
Layer 2 devices exchange Ethernet frames. As defined in IEEE 802.1Q, the PRI field (802.1p field) in the Ethernet frame header identifies the Class of Service (CoS) requirement. Figure 3 shows the PRI field in Ethernet frames.
The 802.1Q header contains a 3-bit PRI field, representing eight service priorities 7, 6, 5, 4, 3, 2, 1 and 0 in descending order of priority.