DSCP vs Linux socket priorities

Sat 27 September 2014

Filed under Linux Networking

Tags Linux Networking

I received some encouraging comments on G+ from Jesper Dangaard Brouer about my previous post on DSCP, Linux and VLAN priorities. Those comments and the work linked to (here and here) points to a few long-standing (but minor) issues with the way DSCP priorities are handled in Linux.

  1. Some DSCP values, like Expedited Forwarding, are not currently (3.17 and earlier) handled correctly.
  2. Linux Priorities, defined in include/uapi/linux/pkt_sched.h, are not documented particularly well, but forms part of the stable interface with userspace. Working with traffic classification (tc), queuing disciplines (qdisc) or VLANs requires at least a basic understanding of Linux socket priorities.

DSCP to Linux Priority table

There are plenty of IP_TOS to DSCP tables on the 'net, but the closest thing to a DSCP to Linux socket priority mapping that I could find was the TOS to Linux socket priority table in the man page for tc-prio.

I decided to use the kernel code to generate a DSCP to Linux Priority table:

DSCP (10 | 16) | DSCP Name | TOS | Linux Prio
       0    0          CS0     0   0 Best Effort
       2    2          ?2?     0   0 Best Effort
       4    4          ?4?     0   0 Best Effort
       6    6          ?6?     0   0 Best Effort
       8    8          CS1     1   2 Bulk
      10    A         AF10     1   2 Bulk
      12    C         AF12     1   2 Bulk
      14    E         AF14     1   2 Bulk
      16   10          CS2     2   6 Interactive
      18   12         AF18     2   6 Interactive
      20   14         AF20     2   6 Interactive
      22   16         AF22     2   6 Interactive
      24   18          CS3     3   4 Interactive Bulk
      26   1A         AF26     3   4 Interactive Bulk
      28   1C         AF28     3   4 Interactive Bulk
      30   1E         AF30     3   4 Interactive Bulk
      32   20          CS4     4   0 Best Effort
      34   22         AF34     4   0 Best Effort
      36   24         AF36     4   0 Best Effort
      38   26         AF38     4   0 Best Effort
      40   28          CS5     5   2 Bulk
      42   2A         ?42?     5   2 Bulk
      44   2C           VA     5   2 Bulk
      46   2E           EF     5   2 Bulk
      48   30          CS6     6   6 Interactive
      50   32         ?50?     6   6 Interactive
      52   34         ?52?     6   6 Interactive
      54   36         ?54?     6   6 Interactive
      56   38          CS7     7   4 Interactive Bulk
      58   3A         ?58?     7   4 Interactive Bulk
      60   3C         ?60?     7   4 Interactive Bulk
      62   3E         ?62?     7   4 Interactive Bulk

Here's the source code that generated the table.

Note how DSCP 44 (Voice Admit) and 46 (Expedited Forwarding) maps to Linux socket priority 2 (Bulk), as mentioned above and in the referenced links. This will hopefully be fixed soon.

There are several DSCP values that are not listed, or listed as ?nn? in the table above. I'm still trying to understand the DSCP model. It seems like the DSCP inventors were on strong medicine when they came up with this idea, but that's probably just my ignorance. Time to read RFC4542 and RFC4594.



rationali.st © Andrew Cooks