For QoS/WMM (EDCA) mac80211 needs driver to have at least four queues. It will then program the queues according to the advertised access parameters.
mac80211 will use the queues as follows:
AC |
queue |
BK |
3 |
BE |
2 |
VI |
1 |
VO |
0 |
802.11 uses the following number scheme (cf. Table 7-36)
AC |
ACI [binary] (AC index [decimal]) |
BK |
01 (1) |
BE |
00 (0) |
VI |
10 (2) |
VO |
11 (3) |
Therefore, we have:
AC |
ACI |
queue |
BK |
01 |
3 |
BE |
00 |
2 |
VI |
10 |
1 |
VO |
11 |
0 |
Due to internal collisions (we don't really know what this means either) the queue numbering is important, and queue 0 is highest priority, 3 lowest. If your hardware has a different idea of queue priority, you may need to rewrite the queue number, but make sure to do it everywhere mac80211 passes a queue number (conf_tx, skb_get_queue_mapping).
The user priority is used as follows (802.11-2007 table 9-1):
UP |
AC |
1 |
BK |
2 |
BK |
0 |
BE |
3 |
BE |
4 |
VI |
5 |
VI |
6 |
VO |
7 |
VO |
(all the rest of this is untested right now!)
mac80211 currently determines the UP based only on the IPv4 TOS field, unless the packet priority is set to 256..263 with setsockopt(SO_PRIORITY), in which case this maps directly to the UP (priority - 256) for testing.
The IPv4 TOS field maps into the UP as follows, but keep in mind that the lowest two bits of the TOS are reserved (or used for ECN):
TOS |
UP |
0 - 31 |
0 |
32 - 63 |
1 |
... |
|
224 - 255 |
7 |
Alternatively you can set the IP_TOS with setsockopt, then you need to ask how the DSCP maps into the UP. Let's start with the TOS field again (RFC 2474):
bit |
0-1 |
2-7 |
meaning |
CU (reserved) |
DSCP |
DSCP |
UP |
0-3 |
0 |
4-7 |
1 |
... |
|
28-31 |
7 |
You can use "ping -Q" to test this, see its manpage.