Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/dtaht/ceropackages-3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
K committed May 15, 2012
2 parents d390b14 + 9007ce7 commit 6bf6795
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 68 deletions.
2 changes: 1 addition & 1 deletion net/debloat/Makefile
Expand Up @@ -8,7 +8,7 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=debloat
PKG_VERSION:=3
PKG_VERSION:=4
PKG_RELEASE:=1

include $(INCLUDE_DIR)/package.mk
Expand Down
22 changes: 21 additions & 1 deletion net/debloat/files/debloat
Expand Up @@ -330,7 +330,8 @@ BINS=env.BINS
MULTICAST=BINS+1
DEFAULTB=BINS+2

PREREQS = { "sch_qfq", "sch_codel", "cls_u32", "cls_flow", "sch_sfq", "sch_red", "sch_htb", "cls_fw" }
PREREQS = { "sch_qfq", "sch_codel", "sch_fq_codel", "cls_u32", "cls_flow",
"sch_sfq", "sch_red", "sch_htb", "cls_fw" }

-- we can get more complex later

Expand Down Expand Up @@ -1242,6 +1243,14 @@ end
-- Various models
local function wireless_fq_codel()
wireless_setup("fq_codel")
end
local function wireless_codel()
wireless_setup("codel")
end
local function wireless_sfq()
wireless_setup("sfq limit 40 perturb 6000")
end
Expand Down Expand Up @@ -1522,6 +1531,13 @@ local function ethernet_qfq(queues)
model_qfq_subdisc(10)
end
local function ethernet_fq_codel(queues)
qa("handle %x root fq_codel target 5ms",10)
end
local function ethernet_codel(queues)
qa("handle %x root codel",10)
end
local function ethernet_sfq(queues)
qa("handle %x root sfq",10)
end
Expand Down Expand Up @@ -1810,6 +1826,8 @@ WCALLBACKS = { ["qfq"] = wireless_qfq,
["efq"] = wireless_efq,
["sfqred"] = wireless_efqr,
["sfqr"] = wireless_sfqr,
["codel"] = wireless_codel,
["fq_codel"] = wireless_fq_codel,
["htb_sfq_red"] = unsupported_shaper,
["oopenwrt"] = unsupported_shaper,
["owshaper"] = unsupported_shaper,
Expand All @@ -1823,6 +1841,8 @@ ECALLBACKS = { ["qfq"] = ethernet_qfq,
["red"] = ethernet_red,
["ared"] = ethernet_ared,
["sfq"] = ethernet_sfq,
["codel"] = ethernet_codel,
["fq_codel"] = ethernet_fq_codel,
["efq"] = ethernet_efq,
["sfqred"] = ethernet_efqr,
["htb_qfq_sfqred"] = htb_qfq_sfqred,
Expand Down
2 changes: 1 addition & 1 deletion net/debloat/files/debloat.hotplug
Expand Up @@ -6,5 +6,5 @@ DEBLOAT_LOG=/dev/null
DEBLOAT_LOG2=/dev/null

[ "$ACTION" = "ifup" ] && {
IFACE=$DEVICE QMODEL=codel /usr/sbin/debloat >> $DEBLOAT_LOG 2>> $DEBLOAT_LOG2
IFACE=$DEVICE QMODEL=fq_codel /usr/sbin/debloat >> $DEBLOAT_LOG 2>> $DEBLOAT_LOG2
}
120 changes: 55 additions & 65 deletions net/debloat/files/simple_qos.sh
@@ -1,6 +1,6 @@
#!/bin/sh
# Cero3 Shaper
# A 3 bin sfqred and ipv6 enabled shaping script for
# A 3 bin tc_codel and ipv6 enabled shaping script for
# ethernet gateways, with an eye towards working well
# with wireless with uplinks in the 2Mbit to 25Mbit
# range. It ain't done yet, and is cerowrt specific
Expand Down Expand Up @@ -60,6 +60,53 @@ iptables $*
ip6tables $*
}

# This could be a complete diffserv implementation

diffserv() {

# While it would be simpler to do this in a loop, we try to find our first matches
# fast which takes the following

#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 1 u32 match ip tos 0x00 0xfc classid 1:12 # CS0
tc filter add dev $DEV protocol ip parent 1:0 prio 2 u32 match ip tos 0x00 0xfc classid 1:12 # CS0
#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 3 u32 match ip6 flowlabel 12345 0xfc classid 1:11 # Low Delay
tc filter add dev $DEV protocol ip parent 1:0 prio 4 u32 match ip tos 0x10 0xfc classid 1:11 # Low Delay
#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 5 u32 match ip tos 0x20 0xfc classid 1:13 # CS1 Bulk
tc filter add dev $DEV protocol ip parent 1:0 prio 6 u32 match ip tos 0x20 0xfc classid 1:13 # CS1 Bulk

#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 4 u32 match ip tos 0x88 0xfc classid 1:11 # AF41
#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 5 u32 match ip tos 0x90 0xfc classid 1:11 # AF42
#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 21 u32 match ip tos 0x98 0xfc classid 1:13 # AF43
#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 7 u32 match ip tos 0x28 0xfc classid 1:12 # AF11
#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 8 u32 match ip tos 0x30 0xfc classid 1:12 # AF12
#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 9 u32 match ip tos 0x38 0xfc classid 1:13 # AF13
#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 10 u32 match ip tos 0x48 0xfc classid 1:12 # AF21
#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 11 u32 match ip tos 0x58 0xfc classid 1:12 # AF22
#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 12 u32 match ip tos 0x58 0xfc classid 1:13 # AF23
#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 13 u32 match ip tos 0x68 0xfc classid 1:12 # AF31
#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 14 u32 match ip tos 0x70 0xfc classid 1:12 # AF32
#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 15 u32 match ip tos 0x78 0xfc classid 1:13 # AF33

#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 16 u32 match ip tos 0x40 0xfc classid 1:12 # CS2
#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 17 u32 match ip tos 0x60 0xfc classid 1:12 # CS3
#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 18 u32 match ip tos 0x80 0xfc classid 1:12 # CS4
#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 19 u32 match ip tos 0xa0 0xfc classid 1:12 # CS5
#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 9 u32 match ip tos 0xc0 0xfc classid 1:11 # CS6
#tc filter add dev $DEV protocol ipv6 parent 1:0 prio 6 u32 match ip tos 0xe0 0xfc classid 1:11 # CS7

# We can't use these on ifb
#tc filter add dev $DEV parent 1:0 protocol ip prio 3 handle 1 fw classid 1:12
#tc filter add dev $DEV parent 1:0 protocol ip prio 4 handle 2 fw classid 1:13
# ipv6 support. Note that the handle indicates the fw mark bucket that is looked for
#tc filter add dev $DEV parent 1:0 protocol ipv6 prio 8 handle 1 fw classid 1:11
#tc filter add dev $DEV parent 1:0 protocol ipv6 prio 9 handle 2 fw classid 1:12
#tc filter add dev $DEV parent 1:0 protocol ipv6 prio 10 handle 3 fw classid 1:13

# Arp traffic
tc filter add dev $DEV parent 1:0 protocol arp prio 7 handle 1 fw classid 1:11
}


ipt_setup() {

ipt -t mangle -F
Expand Down Expand Up @@ -131,9 +178,9 @@ tc class add dev $IFACE parent 1:1 classid 1:13 htb rate ${BK_RATE}kbit ceil ${B
# A depth of 16 is better at low rates, but no lower. I'd argue for a floor of 22
# Packet aggregation suggests 42-64.

tc qdisc add dev $IFACE parent 1:11 handle 110: codel
tc qdisc add dev $IFACE parent 1:12 handle 120: codel
tc qdisc add dev $IFACE parent 1:13 handle 130: codel
tc qdisc add dev $IFACE parent 1:11 handle 110: fq_codel
tc qdisc add dev $IFACE parent 1:12 handle 120: fq_codel
tc qdisc add dev $IFACE parent 1:13 handle 130: fq_codel

tc filter add dev $IFACE parent 1:0 protocol ip prio 1 handle 1 fw classid 1:11
tc filter add dev $IFACE parent 1:0 protocol ip prio 2 handle 2 fw classid 1:12
Expand Down Expand Up @@ -177,70 +224,13 @@ tc class add dev $DEV parent 1:1 classid 1:11 htb rate 32kibit ceil ${PRIO_RATE}
tc class add dev $DEV parent 1:1 classid 1:12 htb rate ${BE_RATE}kibit ceil ${BE_CEIL}kibit prio 2 $ADSLL
tc class add dev $DEV parent 1:1 classid 1:13 htb rate ${BK_RATE}kibit ceil ${BE_CEIL}kibit prio 3 $ADSLL

# The calculations (still) needed here are why I
# wanted to do this in lua first.
# all the variables - limit, depth, min, max, redflowlimit
# are dependent on the bandwidth, but scale differently.
# I don't think RED can be made to work on long RTTs, period...

# I'd prefer to use a pre-nat filter but that causes permutation...
# Anyway... need FP (sqrt) from lua to finish this part...

# A depth of 16 is better at low rates, but no lower.
# I'd argue for a floor of 22 Packet aggregation suggests
# ${DEPTH}-64.

tc qdisc add dev $DEV parent 1:11 handle 110: codel
tc qdisc add dev $DEV parent 1:12 handle 120: codel
tc qdisc add dev $DEV parent 1:13 handle 130: codel

#tc filter add dev $DEV parent 1:0 protocol ip prio 4 u32 match u8 8 \
#fc at 1 classid 1:13
#for i in `seq 4 254`
#do
#a=`printf "tc filter add dev $DEV protocol ip parent 1:0 prio %d u32 match u8 0x%x 0x03 at 1 classid 1:13" $i $i`
#$a
#a=`printf "tc filter add dev $DEV protocol ip parent 1:0 prio %d u32 match ip tos 0x%x 0xfc classid 1:13" $i $i`
#$a
#done

# This could be a complete diffserv implementation

tc filter add dev $DEV protocol ip parent 1:0 prio 1 u32 match ip tos 0x00 0xfc classid 1:12 # CS0
tc filter add dev $DEV protocol ip parent 1:0 prio 2 u32 match ip tos 0x10 0xfc classid 1:11 # Low Delay
tc filter add dev $DEV protocol ip parent 1:0 prio 3 u32 match ip tos 0x20 0xfc classid 1:13 # CS1 Bulk
tc filter add dev $DEV protocol ip parent 1:0 prio 4 u32 match ip tos 0x88 0xfc classid 1:11 # AF41
tc filter add dev $DEV protocol ip parent 1:0 prio 5 u32 match ip tos 0x90 0xfc classid 1:11 # AF42
tc filter add dev $DEV protocol ip parent 1:0 prio 21 u32 match ip tos 0x98 0xfc classid 1:11 # AF43
tc filter add dev $DEV protocol ip parent 1:0 prio 7 u32 match ip tos 0x28 0xfc classid 1:12 # AF11
tc filter add dev $DEV protocol ip parent 1:0 prio 8 u32 match ip tos 0x30 0xfc classid 1:12 # AF12
tc filter add dev $DEV protocol ip parent 1:0 prio 9 u32 match ip tos 0x38 0xfc classid 1:13 # AF13
tc filter add dev $DEV protocol ip parent 1:0 prio 10 u32 match ip tos 0x48 0xfc classid 1:12 # AF21
tc filter add dev $DEV protocol ip parent 1:0 prio 11 u32 match ip tos 0x58 0xfc classid 1:12 # AF22
tc filter add dev $DEV protocol ip parent 1:0 prio 12 u32 match ip tos 0x58 0xfc classid 1:13 # AF23
tc filter add dev $DEV protocol ip parent 1:0 prio 13 u32 match ip tos 0x68 0xfc classid 1:12 # AF31
tc filter add dev $DEV protocol ip parent 1:0 prio 14 u32 match ip tos 0x70 0xfc classid 1:12 # AF32
tc filter add dev $DEV protocol ip parent 1:0 prio 15 u32 match ip tos 0x78 0xfc classid 1:13 # AF33

tc filter add dev $DEV protocol ip parent 1:0 prio 16 u32 match ip tos 0x40 0xfc classid 1:13 # CS2
tc filter add dev $DEV protocol ip parent 1:0 prio 17 u32 match ip tos 0x60 0xfc classid 1:13 # CS3
tc filter add dev $DEV protocol ip parent 1:0 prio 18 u32 match ip tos 0x80 0xfc classid 1:13 # CS4
tc filter add dev $DEV protocol ip parent 1:0 prio 19 u32 match ip tos 0xa0 0xfc classid 1:13 # CS5
tc filter add dev $DEV protocol ip parent 1:0 prio 9 u32 match ip tos 0xc0 0xfc classid 1:11 # CS6
tc filter add dev $DEV protocol ip parent 1:0 prio 6 u32 match ip tos 0xe0 0xfc classid 1:11 # CS7

#tc filter add dev $DEV parent 1:0 protocol ip prio 3 handle 1 fw classid 1:12
#tc filter add dev $DEV parent 1:0 protocol ip prio 4 handle 2 fw classid 1:13

# ipv6 support. Note that the handle indicates the fw mark bucket that is looked for

#tc filter add dev $DEV parent 1:0 protocol ipv6 prio 8 handle 1 fw classid 1:11
#tc filter add dev $DEV parent 1:0 protocol ipv6 prio 9 handle 2 fw classid 1:12
#tc filter add dev $DEV parent 1:0 protocol ipv6 prio 10 handle 3 fw classid 1:13

# Arp traffic
tc qdisc add dev $DEV parent 1:11 handle 110: fq_codel
tc qdisc add dev $DEV parent 1:12 handle 120: fq_codel
tc qdisc add dev $DEV parent 1:13 handle 130: fq_codel

#tc filter add dev $DEV parent 1:0 protocol arp prio 7 handle 1 fw classid 1:11
diffserv

ifconfig ifb0 up

Expand Down

0 comments on commit 6bf6795

Please sign in to comment.