netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Jesper Dangaard Brouer <brouer@redhat.com>, netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Stephen Hemminger <shemminger@vyatta.com>
Subject: [net-next PATCH] net: Correct TOS priority mapping for DSCP EF
Date: Mon, 15 Sep 2014 16:50:47 +0200	[thread overview]
Message-ID: <20140915145023.4834.93706.stgit@dragon> (raw)
In-Reply-To: <=1410783785.7106.154.camel@edumazet-glaptop2.roam.corp.google.com>

The DSCP value for Expedited Forwarding (EF) got mapped to
internal priority TC_PRIO_INTERACTIVE_BULK, which ends up in
medium/best-effort priority band(1) of pfifo_fast

This patch change TOS mapping, causing the DSCP EF to get mapped
to TC_PRIO_INTERACTIVE, which end up in high priority band(0)
of pfifo_fast.

While performing this policy change, document the TOS to priority
lookup table ip_tos2prio[16].  Thus, making it easier to
understand this table for reviewers.

The DSCP AFxx mappings are also suboptimal, but we choose not to
change those mapping, only document the mapping in the code.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
---

 net/ipv4/route.c |   43 +++++++++++++++++++++++++++----------------
 1 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 234a43e..800b6f4 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -168,23 +168,34 @@ static struct dst_ops ipv4_dst_ops = {
 
 #define ECN_OR_COST(class)	TC_PRIO_##class
 
+/* lookup: tos bitmasked 0x1E and shifted right (tos>>1) in rt_tos2priority() */
 const __u8 ip_tos2prio[16] = {
-	TC_PRIO_BESTEFFORT,
-	ECN_OR_COST(BESTEFFORT),
-	TC_PRIO_BESTEFFORT,
-	ECN_OR_COST(BESTEFFORT),
-	TC_PRIO_BULK,
-	ECN_OR_COST(BULK),
-	TC_PRIO_BULK,
-	ECN_OR_COST(BULK),
-	TC_PRIO_INTERACTIVE,
-	ECN_OR_COST(INTERACTIVE),
-	TC_PRIO_INTERACTIVE,
-	ECN_OR_COST(INTERACTIVE),
-	TC_PRIO_INTERACTIVE_BULK,
-	ECN_OR_COST(INTERACTIVE_BULK),
-	TC_PRIO_INTERACTIVE_BULK,
-	ECN_OR_COST(INTERACTIVE_BULK)
+	/* Desc format: two least-significant bits should have been
+	 * for ECN (see "-" split). The hex values represent the TOS
+	 * byte in IP-header (masked with 0x1E)
+	 */
+	TC_PRIO_BESTEFFORT,           /* [0] 000-00 = 0x00 default            */
+	ECN_OR_COST(BESTEFFORT),      /* [1] 000-10 = 0x02 TOS-"mincost"      */
+	TC_PRIO_BESTEFFORT,           /* [2] 001-00 = 0x04 TOS-"reliability"  */
+	ECN_OR_COST(BESTEFFORT),      /* [3] 001-10 = 0x06                    */
+	TC_PRIO_BULK,                 /* [4] 010-00 = 0x08 TOS-"throughput"
+				       * (incidentally maps) DSCP(AF11+21+31+41)
+				       */
+	ECN_OR_COST(BULK),            /* [5] 010-10 = 0x0A                    */
+	TC_PRIO_BULK,                 /* [6] 011-00 = 0x0C                    */
+	ECN_OR_COST(BULK),            /* [7] 011-10 = 0x0E                    */
+	TC_PRIO_INTERACTIVE,          /* [8] 100-00 = 0x10 TOS-"lowdelay"
+				       * (incidentally maps) DSCP(AF12+22+32+42)
+				       */
+	ECN_OR_COST(INTERACTIVE),     /* [9] 100-10 = 0x12                    */
+	TC_PRIO_INTERACTIVE,          /*[10] 101-00 = 0x14                    */
+	ECN_OR_COST(INTERACTIVE),     /*[11] 101-10 = 0x16                    */
+	TC_PRIO_INTERACTIVE_BULK,     /*[12] 110-00 = 0x18
+				       * (incidentally maps) DSCP(AF13+23+33+43)
+				       */
+	ECN_OR_COST(INTERACTIVE_BULK),/*[13] 110-10 = 0x1A                    */
+	TC_PRIO_INTERACTIVE,          /*[14] 111-00 = 0x1C maps DSCP(EF)      */
+	ECN_OR_COST(INTERACTIVE_BULK) /*[15] 111-10 = 0x1E                    */
 };
 EXPORT_SYMBOL(ip_tos2prio);
 

       reply	other threads:[~2014-09-15 14:50 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <=1410783785.7106.154.camel@edumazet-glaptop2.roam.corp.google.com>
2014-09-15 14:50 ` Jesper Dangaard Brouer [this message]
2014-09-15 21:09   ` [net-next PATCH] net: Correct TOS priority mapping for DSCP EF David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140915145023.4834.93706.stgit@dragon \
    --to=brouer@redhat.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).