Sunday, January 9, 2011

The Mess that is QoS in Layer 2

Since I looked at QoS Classification and Marking in the IP Header I figure I might as well finish it off and go over the same topic at Layer 2.  I kept the title, but in reality it's not that bad here.  There's a lot more consistency between the various Layer 2 technologies and things seem to translate pretty well.  The only real challenge comes into play when you need to start translating a Layer 2 marking to a Layer 3 marking, and vice versa.  I'll get to that in a bit, but first lets look at what we have to work with.
First up I'm going to look at our trusty Ethernet.  There are no QoS bits in the Ethernet header.  

That was easy eh?  Well, not really.  Ethernet gets special treatment in that both of the Ethernet trunking protocols, ISL and 802.1Q, allocate 3 bits for QoS purposes.  In ISL these bits are called the Class of Service (CoS) field, while in 802.1Q these bits are the User Priority field.  Call it whatever you want, but they both have 3 bits with which we can classify and mark traffic.


This leaves us with a couple WAN technologies to look at.  Both ATM and Frame Relay have only a single bit, called Cell Loss Priority (CLP) and Discard Eligibility (DE) respectively.  The only purpose of these bits is to signal whether a frame is eligible for discard during times of congestion.  There isn't really a lot of flexibility here.

The last one I'm going to look at is the Experimental (EXP) field in Multi Protocol Label Switching (MPLS).  The MPLS EXP field is 3 bits that were originally reserved, but are not generally used for QoS.   These 3 bits can map directly to the 2 Ethernet QoS methods since both are 3 bits in length.


As I mentioned earlier, the real pain comes in when you want to start mapping these values to the IP Header methods, specifically to AF PHB.  Since the Ethernet CoS Values and MPLS EXP bits are effectively the same as the CS PHB in DiffServ you can map these directly to each other in a one-to-one manner.  


On Cisco switches there's default mappings for all this, and they vary depending on which direction you are converting to.  The default CoS to DSCP mapping is as follows:


CoS 0 1 2 3 4 5 6 7
DSCP 0 8 16 24 32 40 48 56


You'll note that the DSCP values are the CS PHB values.


To convert the other way, DSCP to CoS, we have a default map that looks like so:


DSCP 0-7 8-15 16-23 24-31 32-39 40-47 48-55 56-63
CoS 0 1 2 3 4 5 6 7


These values actually make sense if you break it into binary and see that the 3 most significant bytes are what drives this.  CoS 4 maps directly to CS4 which maps to AF4y which maps to IPP Flash Override (4).  


Finally, let's just take a quick look at the DSCP-to-EXP and EXP-to-DSCP default mappings:



DSCP 0-7 8-15 16-23 24-31 32-39 40-47 48-55 56-63
EXP 0 1 2 3 4 5 6 7



EXP 0 1 2 3 4 5 6 7
DSCP 0 8 16 24 32 40 48 56


Exactly the same as the CoS mappings.  Finally something in QoS that makes sense!


There are other default mappings such as IPP to/from DSCP, and then there are mutations to convert DSCP to DSCP, but I'm going to leave those for now and simply link you to the documentation on Cisco.com.  Enjoy!

No comments:

Post a Comment