OpenWrt Forum Archive

Topic: tc qdisc htb error?? here's the solution

The content of this topic has been archived on 24 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

For some reason, tc binary doesn't supports hbt qdisc.
You cant test it with this line:
 

tc qdisc add dev eth2 root handle 1: htb default 20

If u get this error or similar:
 

Unknown qdisc "htb", hence option "default" is unparsable

Then your tc binary needs a htb3-3.6 patch from HTB homepage.
Or u can get the tc binary from here
http://www.auxi.net/tc

Regards!

Hi.
I run into same problem so I wanted to get that htb patch working in my buildroot.

I don't see any iproute2 source so OpenWRT leaves this out.
Only tc can be found in ...drivers directory in source, but no q_htb.c source.

Can you tell me where you downloaded iproute2 source to get it compiled (for tc only) in buildroot ?
How can you turn off drivers/tc build-in into openwrt.bin but instead of include iproute2 patched htb3.6 tc ?

Sorry, I'm kinda new to linux developing.

Searching for the main iproute2 page on internet I had no real luck so far.

Blackvel

This is the header of my iproute2.mk, it works for me very well.

 
################################################
# iproute2
#
###############################################

IPROUTE2_DIR=$(BUILD_DIR)/iproute2
LINUX_SOURCE_DIR=/home/xavi/openwrt/buildroot/build_mipsel/linux

#IPROUTE2_SOURCE_URL=ftp://ftp.inr.ac.ru/ip-routing/
#IPROUTE2_SOURCE=iproute2-2.4.7-now-ss020116-try.tar.gz

#Use the debian source for now, as the .ru site has availability problems
IPROUTE2_SOURCE_URL=http://ftp.debian.org/debian/pool/main/i/iproute/
IPROUTE2_SOURCE=iproute_20010824.orig.tar.gz
#IPROUTE2_PATCH=iproute_20010824-13.diff.gz
IPROUTE2_PATCH=htb3.6_tc.diff

Regards!!

Xavi.

Thank you for your help.
This had pointed me still to some problems with iproute2.

Here you can find my solutions (just for the others), including a full iproute2.mk.

http://openwrt.ksilebo.net/forum/viewto … ?p=236#236

Btw, the tc binary on the site mentioned is not stripped!

-rwxr-xr-x    1 root     root       154296 Apr 28 21:16 tc (stripped)
-rwxr-xr-x    1 root     root       748624 Apr 28 19:02 tc (non-stripped)

I did the same failure to forget to strip the file smile smile

Just now I have the following problems with tc htb (didnt try cbq yet) :

/usr/sbin # ./tc qdisc add dev vlan1 root handle 1: htb default 20
RTNETLINK answers: Invalid argument
/usr/sbin # ./tc qdisc add dev eth1 root handle 1: htb default 20
RTNETLINK answers: Invalid argument

I had patched linux kernel, maybe it did something wrong in a tcp file ?
Is there any way howto find out, what rtnetlink is telling me, in more detail ?

Thank

Blackvel

Obviusly, the patch tha we use now it's not gzipped, so we must use cat, no zcat to apply  it

So the entire header rest like this:

#############################################################
#
# iproute2
#
#############################################################
IPROUTE2_DIR=$(BUILD_DIR)/iproute2
LINUX_SOURCE_DIR=/home/xavi/openwrt/buildroot/build_mipsel/linux
                                                                                                                                                             
#IPROUTE2_SOURCE_URL=ftp://ftp.inr.ac.ru/ip-routing/
#IPROUTE2_SOURCE=iproute2-2.4.7-now-ss020116-try.tar.gz
                                                                                                                                                             
#Use the debian source for now, as the .ru site has availability problems
IPROUTE2_SOURCE_URL=http://ftp.debian.org/debian/pool/main/i/iproute/
IPROUTE2_SOURCE=iproute_20010824.orig.tar.gz
#IPROUTE2_PATCH=iproute_20010824-13.diff.gz
IPROUTE2_PATCH=htb3.6_tc.diff
                                                                                                                                                             
$(DL_DIR)/$(IPROUTE2_SOURCE):
         $(WGET) -P $(DL_DIR) $(IPROUTE2_SOURCE_URL)$(IPROUTE2_SOURCE)
                                                                                                                                                             
$(DL_DIR)/$(IPROUTE2_PATCH):
        $(WGET) -P $(DL_DIR) $(IPROUTE2_SOURCE_URL)/$(IPROUTE2_PATCH)
                                                                                                                                                             
iproute2-source: $(DL_DIR)/$(IPROUTE2_SOURCE) $(DL_DIR)/$(IPROUTE2_PATCH)
                                                                                                                                                             
$(IPROUTE2_DIR)/.unpacked: $(DL_DIR)/$(IPROUTE2_SOURCE) #$(DL_DIR)/$(IPROUTE2_PATCH)
        rm -rf $(IPROUTE2_DIR).orig $(IPROUTE2_DIR)
        zcat $(DL_DIR)/$(IPROUTE2_SOURCE) | tar -C $(BUILD_DIR) -xvf -
        cat $(DL_DIR)/$(IPROUTE2_PATCH) | patch -p1 -d $(IPROUTE2_DIR)
                                                                                                                                                             

Sorry

Regards!!

Xavi

Just now I have the following problems with tc htb (didnt try cbq yet) :

/usr/sbin # ./tc qdisc add dev vlan1 root handle 1: htb default 20
RTNETLINK answers: Invalid argument
/usr/sbin # ./tc qdisc add dev eth1 root handle 1: htb default 20
RTNETLINK answers: Invalid argument

You have to make the kernel QoS support.

Look into:
buildroot/sources/openwrt-wrt54g-linux.config

CONFIG_NET_SCH_CBQ=m
...

You will find that QoS features come with OpenWRT mostly supported by Loadable Modules.
Load the Modules required.
Or, just turn on all of them under this section.

CONFIG_NET_SCH_CBQ=y
...

Delete the WRT54G tree. make.

Hurra.

It works! My linux kernel ain't broken (I did some patching as well) smile

Thanx a lot for this tip muyi. Whats your bank address ? smile

I have copied now

-rw-r--r--    1 root     root        23748 Jan  2 00:12 sch_cbq.o
-rw-r--r--    1 root     root        32572 Jan  2 00:12 sch_htb.o
-rw-r--r--    1 root     root         6516 Jan  2 01:07  sch_sfq.o
-rw-r--r--    1 root     root         4216 Jan  2 00:12 sch_ingress.o

from the openwrt-kmodules.tar.bz2 (kernel/2.4.20/net/sched)
to /lib/modules/2.4.20 and used insmod to load them (going to add this into /etc/rcS).

It works like a charm.
/usr/sbin # ./tc qdisc add dev vlan1 root handle 1: htb default 20
/usr/sbin # ./tc qdisc show dev vlan1
qdisc htb 1: r2q 10 default 20 direct_packets_stat 0

I probably will also add from kernel/2.4.20/net/ipv4
ipt_conntrack.o
ipt_TOS.o / ipt_tos.o

for marking packets in iptables for real QOS playing smile

If you are using wondershaper htb script, make sure you also copy:
cls_u32.o
sch_ingress.o
sch_prio.o
sch_sfq.o
ipt_tos.o / ipt_TOS.o

I found out by try-and-error smile
Also for wondershaper the calculation of the uplink class 1:20 and 1:30 seems not working, since no /bin/bash is available.
All calculations with $[9*$UPLINK/10]kbit exit with error; I have changed #!/bin/bash to #!/bin/sh.

Also tc can not be found by wshaper.htb script. so I added an alias tc=/usr/sbin in /etc/rcS BEFORE firewall.sh, where I'm starting qos_shaping.sh (wshaper actually smile ).

The default in openwrt-linux.config is this:

#
# QoS and/or fair queueing
#
CONFIG_NET_SCHED=y
CONFIG_NET_SCH_CBQ=m
CONFIG_NET_SCH_HTB=m
CONFIG_NET_SCH_CSZ=m
CONFIG_NET_SCH_PRIO=m
CONFIG_NET_SCH_RED=m
CONFIG_NET_SCH_SFQ=m
CONFIG_NET_SCH_TEQL=m
CONFIG_NET_SCH_TBF=m
CONFIG_NET_SCH_GRED=m
CONFIG_NET_SCH_DSMARK=m
CONFIG_NET_SCH_INGRESS=m
CONFIG_NET_QOS=y
CONFIG_NET_ESTIMATOR=y
CONFIG_NET_CLS=y
CONFIG_NET_CLS_TCINDEX=m
CONFIG_NET_CLS_ROUTE4=m
CONFIG_NET_CLS_ROUTE=y
CONFIG_NET_CLS_FW=m
CONFIG_NET_CLS_U32=m
CONFIG_NET_CLS_RSVP=m
CONFIG_NET_CLS_RSVP6=m
CONFIG_NET_CLS_POLICE=y

I have just really forgotton to change anything to y.

Probably a rm /home/blackvel/buildroot/build_mipsel/WRT54GS/release/src
/linux/linux/.configured

might also work instead of deleting the whole WRT54GS directory.

Can that be ?

I had also to change the wshaper.htb script.

#!bin/bash to #!/bin/sh

$[9*$UPLINK/10]kbit to $((9*${UPLINK}/10))
also for 8*$UPLINK.

NOPRIOPORTSRC='21 20 109 110 143 220 993 4662 4663 4072 4073'

I included the port list by ' and ' .
Seems not working otherwise.

Now I just have to rewrite the wshaper script so you can also high priority telnet/ssh/web and you don't have to provide a low priority list for each port.

For P2P I plan to use iptables-p2p, which can be marked by connmark and be easily shaped to some very low priority class in wshaper qos script.

Keep prepared smile

Blackvel

Good job, Blackvel.

You have done much more than me. big_smile

By the way, my kernel has grown merely additional 40k when I merged ALL Qos modules into it. If you need some modules all the way and the size matters for you,  you might want to build it in.

HTB seems a little buggy still.

# dmesg
htb*g j=7695911
htb*r7 m=0
htb*r6 m=0
htb*r5 m=0
htb*r4 m=0
htb*r3 m=0
htb*r2 m=0
htb*r1 m=0
htb*r0 m=0
htb*c10001 m=2 t=157286 c=49152 pq=0 df=1411022848 ql=0 pa=0 f:
htb*c10010 m=2 t=157286 c=49152 pq=0 df=1410940928 ql=0 pa=0 f:
htb*c10020 m=2 t=174762 c=53702 pq=0 df=1410850816 ql=0 pa=0 f:
htb*c10030 m=2 t=196608 c=59392 pq=0 df=1410768896 ql=0 pa=0 f:

Have you tried dmesg yet?
Maybe need to update sch_htb.c, which looks like patched by Linksys but still pretty old.

I had also to change the wshaper.htb script.

#!bin/bash to #!/bin/sh

$[9*$UPLINK/10]kbit to $((9*${UPLINK}/10))
also for 8*$UPLINK.

busybox isn't bash... but it does provide an expr command which can be used to replace the bash math:

change this:  $[8*UPLINK/10]

to this:  `expr 8 '*' $UPLINK / 10`

(edit) obviously i shouldn't make suggestions while too sleepy to read what i was quoting!   ignore this post... and use $(())

There's no need to use the expr command, as Blackvel has pointed out you can simply change $[ ... ] to $(( ... ))

For some reason, tc binary doesn't supports hbt qdisc.
You cant test it with this line:
 

tc qdisc add dev eth2 root handle 1: htb default 20

If u get this error or similar:
 

Unknown qdisc "htb", hence option "default" is unparsable

Then your tc binary needs a htb3-3.6 patch from HTB homepage.
Or u can get the tc binary from here
http://www.auxi.net/tc

Regards!

Hello,

I am tryingo to configure QoS.
I download that file and configure this options:
CEIL=240
tc qdisc add dev eth0 root handle 1: htb default 15
tc class add dev eth0 parent 1: classid 1:1 htb rate ${CEIL}kbit ceil ${CEIL}kbit
tc class add dev eth0 parent 1:1 classid 1:10 htb rate 80kbit ceil 80kbit prio 0
tc class add dev eth0 parent 1:1 classid 1:11 htb rate 80kbit ceil ${CEIL}kbit prio 1
tc class add dev eth0 parent 1:1 classid 1:12 htb rate 20kbit ceil ${CEIL}kbit prio 2
tc class add dev eth0 parent 1:1 classid 1:13 htb rate 20kbit ceil ${CEIL}kbit prio 2
tc class add dev eth0 parent 1:1 classid 1:14 htb rate 10kbit ceil ${CEIL}kbit prio 3
tc class add dev eth0 parent 1:1 classid 1:15 htb rate 30kbit ceil ${CEIL}kbit prio 3
tc qdisc add dev eth0 parent 1:12 handle 120: sfq perturb 10
tc qdisc add dev eth0 parent 1:13 handle 130: sfq perturb 10
tc qdisc add dev eth0 parent 1:14 handle 140: sfq perturb 10
tc qdisc add dev eth0 parent 1:15 handle 150: sfq perturb 10


tc filter add dev eth0 parent 1:0 protocol ip prio 1 handle 1 fw classid 1:10
tc filter add dev eth0 parent 1:0 protocol ip prio 2 handle 2 fw classid 1:11
tc filter add dev eth0 parent 1:0 protocol ip prio 3 handle 3 fw classid 1:12
tc filter add dev eth0 parent 1:0 protocol ip prio 4 handle 4 fw classid 1:13
tc filter add dev eth0 parent 1:0 protocol ip prio 5 handle 5 fw classid 1:14
tc filter add dev eth0 parent 1:0 protocol ip prio 6 handle 6 fw classid 1:15


All was perfect after install some modules. The problem is when i try to make a show to control de correct use of the QoS.
When i try to make a "tc -s class show dev eth0" it makes me:
cñass htb 1:11 parent 1:1 [cannot parse class parameters]
Sent 0 bytes 0 pkts (gropped 0, overlimists 0)
Segmentation fault.

Anyone can help me.

Thansks

Omar wrote:

When i try to make a "tc -s class show dev eth0" it makes me:
cñass htb 1:11 parent 1:1 [cannot parse class parameters]
Sent 0 bytes 0 pkts (gropped 0, overlimists 0)
Segmentation fault.

Anyone can help me.

Thansks

Me.

I was not using the correct tc binary.

The discussion might have continued from here.