CBQ and all other qdiscs now REALLY completely documented (almost!)
Quoted 5 lines · jamal
Linux remaps packets incoming with different values to some internal value; the colum "mapped to" shows the internal mapping
8value(hex) TOS(dec) mapped to(dec)
----------------------------------
Quoted 16 lines
0x0 0 0
1 7
2 0
3 0
4 2
5 2
6 2
7 2
0x10 8 6
9 6
10 6
11 6
12 2
13 2
14 2
15 2I find this tos2prio table in the kernel (2.5.x), which is somewhat different than your table:
0 TC_PRIO_BESTEFFORT, 0 1 TC_PRIO_(FILLER), 1 2 TC_PRIO_BESTEFFORT, 0 3 TC_PRIO_(BESTEFFORT), 0 4 TC_PRIO_BULK, 2 5 TC_PRIO_(BULK), 2 6 TC_PRIO_BULK, 2 7 TC_PRIO_(BULK), 2 8 TC_PRIO_INTERACTIVE, 6 9 TC_PRIO_(INTERACTIVE), 6 10 TC_PRIO_INTERACTIVE, 6 11 TC_PRIO_(INTERACTIVE), 6 12 TC_PRIO_INTERACTIVE_BULK, 4 13 TC_PRIO_(INTERACTIVE_BULK), 4 14 TC_PRIO_INTERACTIVE_BULK, 4 15 TC_PRIO_(INTERACTIVE_BULK) 4
Quoted 13 lines
Fill in the "8value(hex)" column gaps using the bitmap from RFC1349 for the 8 bits; These are the values ou would see with tcpdump -vvv I filled the two easiest ones i could compute in my head.
Second step:
Take the default priority map:
1, 2, 2, 2, 1, 2, 0, 0 , 1, 1, 1, 1, 1, 1, 1, 1
This applies for both default prio and the 3-band FIFO queue. Note the queue map fitted on the last column8 but value TOS mapped to queue map
---------------------------------------------
Quoted 16 lines
0x0 0 0 1
1 7 2
2 0 2
3 0 2
4 2 1
5 2 2
6 2 0
7 2 0
0x10 8 6 1
9 6 1
10 6 1
11 6 1
12 2 1
13 2 1
14 2 1
15 2 1I've changed this table to:
TOS Bits Means Linux Priority Band
------------------------------------------------------------
0x0 0 Normal Service 0 Best Effort 1 0x2 1 Minimize Monetary Cost 1 Filler 2 0x4 2 Maximize Reliability 0 Best Effort 1 0x6 3 mmc+mr 0 Best Effort 1 0x8 4 Maximize Throughput 2 Bulk 2 0xa 5 mmc+mt 2 Bulk 2 0xc 6 mr+mt 2 Bulk 2 0xe 7 mmc+mr+mt 2 Bulk 2 0x10 8 Minimize Delay 6 Interactive 0 0x12 9 mmc+md 6 Interactive 0 0x14 10 mr+md 6 Interactive 0 0x16 11 mmc+mr+md 6 Interactive 0 0x18 12 mt+md 4 Int. Bulk 1 0x1a 13 mmc+mt+md 4 Int. Bulk 1 0x1c 14 mr+mt+md 4 Int. Bulk 1 0x1e 15 mmc+mr+mt+md 4 Int. Bulk 1
http://ds9a.nl/lartc/HOWTO/cvs/2.4routing/output/2.4routing-9.html#ss9.2
Your table appears to imply that a Maximum Reliability, Mininum Delay packet, TOS bits=9, gets mapped to band 1, not 0, which would not make sense.
Laying it out like this, which does appear how it works, does mean that you can specify priorities in the priomap which do not correspond to possible TOS values.
Is it possible at all to set skb->priority from userspace without going through the tos2prio mapping?
CBQ can use the skb->priority to classify:
/*
* Step 1. If skb->priority points to one of our classes, use it.
*/
if (TC_H_MAJ(prio^sch->handle) = 0 &&
(cl = cbq_class_lookup(q, prio)) != NULL)
return cl;But to do this, you would need to be able to set skb->priority to a 32bit number:
include/linux/pkt_sched.h:#define TC_H_MAJ_MASK (0xFFFF0000U) include/linux/pkt_sched.h:#define TC_H_MAJ(h) ((h)&TC_H_MAJ_MASK)
I can't find where you would do this, any clues?
Thanks again for taking the time to help me.
Regards,
bert
Signature · 8 lines
http://www.PowerDNS.com Versatile DNS Software & Services Trilab The Technology People Netherlabs BV / Rent-a-Nerd.nl - Nerd Available - 'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet _______________________________________________ LARTC mailing list / [email protected] http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/
Quoted 3 lines · jamal
Yes, sorry the last 4 are
int_bulk(value 4) and not just bulk (2). good eye. You are still abusing the word TOS. Thats only 4 bits not 8; Use the terminology from RFC1349 at least.
Will do.
Quoted 8 lines
Quoted 5 lines
http://ds9a.nl/lartc/HOWTO/cvs/2.4routing/output/2.4routing-9.html#ss9.2
Your table appears to imply that a Maximum Reliability, Mininum Delay packet, TOS bits=9, gets mapped to band 1, not 0, which would not make sense.
This is the priomap: 1, 2, 2, 2, 1, 2, 0, 0 , 1, 1, 1, 1, 1, 1, 1, 1 It says 1 is the right value
AFAICT, the priomap maps skb->priority to band. So the translation is as follows:
Type of Service octet, which is fed to:
skb->priority = rt_tos2priority(iph->tos);
To extract the four TOS bits, and to translate to prio:
static inline char rt_tos2priority(u8 tos)
{
return ip_tos2prio[IPTOS_TOS(tos)>>1];
}----
__u8 ip_tos2prio[16] = {
TC_PRIO_BESTEFFORT,
ECN_OR_COST(FILLER),
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)
};---
#define TC_PRIO_BESTEFFORT 0 #define TC_PRIO_FILLER 1 #define TC_PRIO_BULK 2 #define TC_PRIO_INTERACTIVE_BULK 4 #define TC_PRIO_INTERACTIVE 6 #define TC_PRIO_CONTROL 7 #define TC_PRIO_MAX 15
net/sched/sched_generic.c:
static const u8 prio2band[TC_PRIO_MAX+1] { 1, 2, 2, 2, 1, 2, 0, 0 , 1, 1, 1, 1, 1, 1, 1, 1 };
list = ((struct sk_buff_head*)qdisc->data) +
prio2band[skb->priority&TC_PRIO_MAX];Quoted 3 lines
Quoted 1 line
CBQ can use the
skb->priorityto classify:so do prio and
pfifo_fast(as i am sure you are aware)
Of course, but only CBQ (& HTB, by the way) can extract a classid directly from it, without a priomap. Devik is planning to learn HTB to extract a classid directly from the fwmark, to skip a layer of indirection.
Regards,
bert hubert
Signature · 8 lines
http://www.PowerDNS.com Versatile DNS Software & Services Trilab The Technology People Netherlabs BV / Rent-a-Nerd.nl - Nerd Available - 'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet _______________________________________________ LARTC mailing list / [email protected] http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/lartc/