Background regarding the 802.1Q TCI Priority bits and IP TOS (DSCP) bits

  • 0
  • 1
  • Article
  • Updated 5 years ago
  • (Edited)
Article ID: 5811 

Protocols/Features
TOS
DSCP
QoS
CoS 

Standards
802.1Q
802.1p 

Related to
TCI
Priority 

Goals
Location of 802.1Q TCI / Priority bits
Location / decode of IP TOS / DSCP bits 

Symptoms
VLAN tag
IP header 

Cause
Any discussion of Quality of Service or Class of Service will typically include examining and/or setting the 802.1Q TCI Priority bits and/or the IP Type of Service / Differentiated Services Code Point bits. 

This solution outlines where these fields are located in an Ethernet_II frame, and also provides a bit decoder for the IP Precedence and DSCP fields. 

Solution
802.1Q TCI Priority bits 

The Tag Control Information Priority bits are located in the optional 802.1Q VLAN Tag. If present, the Tag is inserted as Layer 2 information immediately following the Destination and Source MAC addresses, and preceding the ethertype. 

This 32-bit (4-byte) tag has the following layout:
 bits 001-016  (2 bytes) TPID                          0x8100 ("ethertype")
bits 017-032 (2 bytes) TCI (Tag Control Information)
bits 17-19 (3 bits) 802.1p Priority 0x0 -> 0x7 (0 -> 7)
bits 20-20 (1 bit) Canonical Format Indicator 0x0 for ethernet traffic
bits 21-32 (12 bits) VLAN ID 0x000 -> 0xfff (0 -> 4095)

Devices which evaluate a packet deeper than the Layer 2 MAC addressing and which do not recognize ethertype 0x8100 (are not "802.1Q aware") will drop the packet. 
Devices which evaluate a packet deeper than the Layer 2 MAC addressing and which do recognize ethertype 0x8100 (are "802.1Q aware") will read the Tag information and then parse past it to the true ethertype field. 

If the ethertype is 0x0800 (IP), then the IP Header will follow. 

IP TOS bits 

The IP TOS field is located in the IP Header. 

This 160-bit (20-byte) header has the following layout:
 bits 001-004  (4 bits)  IP Version                     0x4 (IPv4) or 0x6 (IPv6)
bits 005-008 (4 bits) Header length in 32-bit words 0x5 (160 bits)
bits 009-016 (1 byte) TOS - Type of Service byte
bits 09-11 (3 bits) IP Precedence (see decoder) 0x0 -> 0x7 (0 -> 7)
bits 12-15 (4 bits) TOS field 0x0 -> 0xf (0 -> 15)
bits 12-12 (1 bit) Minimize Delay 0x1 (set) or 0x0 (not set)
bits 13-13 (1 bit) Maximize Throughput 0x1 (set) or 0x0 (not set)
bits 14-14 (1 bit) Maximize Reliability 0x1 (set) or 0x0 (not set)
bits 15-15 (1 bit) Minimize Monetary Cost 0x1 (set) or 0x0 (not set)
bits 16-16 (1 bit) currently unused 0x0
bits 009-016 (1 byte) Differentiated Services byte (TOS byte redefinition)
bits 09-14 (6 bits) DSCP (see decoder) 0x00 -> 0x3f (0 -> 63)
bits 15-15 (1 bit) Explicit Cong Notif capable 0x1 (set) or 0x0 (not set)
bits 16-16 (1 bit) Explicit Cong Notif eligible 0x1 (set) or 0x0 (not set)
bits 017-032 (2 bytes) Total IP datagram length 0x0000 -> 0xffff (0 -> 65535)
bits 033-048 (2 bytes) Identification for reassembly 0x0000 -> 0xffff (0 -> 65535)
bits 049-049 (1 bit) Reserved flag 0x0
bits 050-050 (1 bit) Don't Fragment flag 0x1 (set) or 0x0 (not set)
bits 051-051 (1 bit) More Fragments flag 0x1 (set) or 0x0 (not set)
bits 052-064 (13 bits) Frag offset in 64-bit words 0x0000 -> 0x1fff (0 -> 8191)
bits 065-072 (1 byte) TTL - Time to Live 0x00 -> 0xff (0 -> 255)
bits 073-080 (1 byte) Protocol (L4 originator) 0x06 (TCP), 0x11 (UDP), etc
bits 081-096 (2 bytes) Header checksum 0x0000 -> 0xffff
bits 097-128 (4 bytes) Source IP address (IPv4) 0.0.0.0 -> 255.255.255.255
bits 129-160 (4 bytes) Destination IP address (IPv4) 0.0.0.0 -> 255.255.255.255

IP Precedence / DSCP decoder
 

The "well known" IP Precedence / DiffServ Code Point values (as defined by RFC2474, RFC2597, and RFC3246) are listed here in order from lowest to highest priority:
 Precedence  Precedence value   DSCP   Class      Drop         DSCP value
Mnemonic (binary) (decimal) Mnem Selector Precedence (binary) (decimal)
****************************** **********************************************

Routine 0x'000' 0 be 0x'000000' 00
cs0 0x'000000' 00
cs1 0x'001000' 08
Priority 0x'001' 1 af11 1 Low 0x'001010' 10
Priority 0x'001' 1 af12 1 Medium 0x'001100' 12
Priority 0x'001' 1 af13 1 High 0x'001110' 14
cs2 0x'010000' 16
Immediate 0x'010' 2 af21 2 Low 0x'010010' 18
Immediate 0x'010' 2 af22 2 Medium 0x'010100' 20
Immediate 0x'010' 2 af23 2 High 0x'010110' 22
cs3 0x'011000 24
Flash 0x'011' 3 af31 3 Low 0x'011010' 26
Flash 0x'011' 3 af32 3 Medium 0x'011100' 28
Flash 0x'011' 3 af33 3 High 0x'011110' 30
cs4 0x'100000' 32
Override 0x'100' 4 af41 4 Low 0x'100010' 34
Override 0x'100' 4 af42 4 Medium 0x'100100' 36
Override 0x'100' 4 af43 4 High 0x'100110' 38
cs5 0x'101000' 40
Critical 0x'101' 5 ef 0x'101110' 46
cs6 0x'110000' 48
Int Ctl 0x'110' 6
cs7 0x'111000' 56
Net Ctl 0x'111' 7
Photo of FAQ User

FAQ User, Official Rep

  • 13,620 Points 10k badge 2x thumb

Posted 5 years ago

  • 0
  • 1

There are no replies.

This conversation is no longer open for comments or replies.