@@ -208,7 +208,7 @@ static inline void ip_rt_put(struct rtable *rt)
#define IPTOS_RT_MASK (IPTOS_TOS_MASK & ~3)
extern const __u8 ip_tos2prio[16];
-
+// hey diff
static inline char rt_tos2priority(u8 tos)
{
return ip_tos2prio[IPTOS_TOS(tos)>>1];
@@ -18,10 +18,11 @@
#define _UAPI_LINUX_IP_H
#include <linux/types.h>
#include <asm/byteorder.h>
-
+// hey diff here is the IPTOS_TOS_MASK
#define IPTOS_TOS_MASK 0x1E
#define IPTOS_TOS(tos) ((tos)&IPTOS_TOS_MASK)
#define IPTOS_LOWDELAY 0x10
+// Hmmm, is IPTOS_LOWDELAY exported to userspace?
#define IPTOS_THROUGHPUT 0x08
#define IPTOS_RELIABILITY 0x04
#define IPTOS_MINCOST 0x02
@@ -19,6 +19,7 @@
#define TC_PRIO_BESTEFFORT 0
#define TC_PRIO_FILLER 1
#define TC_PRIO_BULK 2
+// hey diff look at priority defines here
#define TC_PRIO_INTERACTIVE_BULK 4
#define TC_PRIO_INTERACTIVE 6
#define TC_PRIO_CONTROL 7
@@ -168,23 +168,24 @@ static struct dst_ops ipv4_dst_ops = {
#define ECN_OR_COST(class) TC_PRIO_##class
-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)
+/* lookup: tos bitmasked 0x1E and shifted right (tos>>1) in rt_tos2priority(tos) */
+const __u8 ip_tos2prio[16] = { // lower-two bits should have been for ECN (see "-" split)
+ TC_PRIO_BESTEFFORT, // [0] 000-00 = 0x00 default
+ ECN_OR_COST(BESTEFFORT), // [1] 000-10 = 0x02 TOS-"mincost" (conflict with ECN bits)
+ 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" 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" - 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 DSCP(AF13+23+33+43)
+ ECN_OR_COST(INTERACTIVE_BULK),// [13] 110-10 = 0x1A
+ TC_PRIO_INTERACTIVE_BULK, // [14] 111-00 = 0x1C DSCP(EF) (0x5C & 0x1E)=0x1C
+ ECN_OR_COST(INTERACTIVE_BULK) // [15] 111-10 = 0x1E
};
EXPORT_SYMBOL(ip_tos2prio);
@@ -408,7 +408,12 @@ static struct Qdisc noqueue_qdisc = {
.busylock = __SPIN_LOCK_UNLOCKED(noqueue_qdisc.busylock),
};
-
+// ToS 0x10 maps to TC_PRIO_INTERACTIVE=6 => band 0
+// DSCP(EF) maps to TC_PRIO_INTERACTIVE_BULK=4 => band 1
+//
+// DSCP(AF11+21+31+41) TC_PRIO_BULK=2 => band 2
+// DSCP(AF12+22+32+42) TC_PRIO_INTERACTIVE=6 => band 0
+// DSCP(AF13+23+33+43) TC_PRIO_INTERACTIVE_BULK=4 => band 1
static const u8 prio2band[TC_PRIO_MAX + 1] = {
1, 2, 2, 2, 1, 2, 0, 0 , 1, 1, 1, 1, 1, 1, 1, 1
};