* [net-next PATCH] net: Correct TOS priority mapping for DSCP EF
[not found] <=1410783785.7106.154.camel@edumazet-glaptop2.roam.corp.google.com>
@ 2014-09-15 14:50 ` Jesper Dangaard Brouer
2014-09-15 21:09 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Jesper Dangaard Brouer @ 2014-09-15 14:50 UTC (permalink / raw)
To: Jesper Dangaard Brouer, netdev
Cc: David S. Miller, Eric Dumazet, Stephen Hemminger
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);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [net-next PATCH] net: Correct TOS priority mapping for DSCP EF
2014-09-15 14:50 ` [net-next PATCH] net: Correct TOS priority mapping for DSCP EF Jesper Dangaard Brouer
@ 2014-09-15 21:09 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-09-15 21:09 UTC (permalink / raw)
To: brouer; +Cc: netdev, eric.dumazet, shemminger
From: Jesper Dangaard Brouer <brouer@redhat.com>
Date: Mon, 15 Sep 2014 16:50:47 +0200
> 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>
I don't think you can make these mappings given that we don't
take the code-service bits of the TOS into account when we use
this table at all.
The DSCP values are composed in the top 6 bits, but we are only
considering the low 3 bits of that field (along with the high
bit of "CU", which is part of the ECN value and thus "don't care")
We should only match EF when the top two DSCP bits are "10".
This table and it's relationship to DSCP is confusing (but your
comments in this patch helped a lot, thanks). Also it isn't
clear why we don't interpret the full DSCP field.
ECN_OR_COST() does nothing but serve as an annotation meaning
that this value has an ECN bit set.
So why don't we shift down by two bits, to get rid of the entire
"CU" field, and consider all 6 bits of the DSCP value in the
ip_tos2prio[] table?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-09-15 21:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <=1410783785.7106.154.camel@edumazet-glaptop2.roam.corp.google.com>
2014-09-15 14:50 ` [net-next PATCH] net: Correct TOS priority mapping for DSCP EF Jesper Dangaard Brouer
2014-09-15 21:09 ` David Miller
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).