Skip to contentSkip to conversation

tc statistics

LARTC Serguei I. Ivantsov 6 participants 7 messages May 29, 2001 – Feb 12, 2007

lore
Share & tools
lore
#0 lore raw

Hi!

How can I treat the output of "tc -s class ls dev eth0" below ? What does it means "overlimits", "backlog"?
Why there is no "dropped" packets?

class cbq 10:400 parent 10:1 leaf 802c: rate 4Kbit (bounded,isolated) prio 5
Sent 10621 bytes 26 pkts (dropped 0, overlimits 38)
rate 649bps 2pps backlog 16p
borrowed 0 overactions 7 avgidle -2.18325e+06 undertime 1.43414e+06

--
Regards,
Serguei I. Ivantsov

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/

#1 lore raw

[LARTC] TC statistics

All,

What kind of statistics are available using tc?

I have the following rules and I want to see the statistics something like number of packets transmitted from each queue.

The rules:

tc qdisc add dev eth0 root handle 1: prio bands 3 priomap 0 1 2

tc qdisc add dev eth0 parent 1:1 handle 2: pfifo limit 1024 tc qdisc add dev eth0 parent 1:2 handle 3: pfifo limit 1024 tc qdisc add dev eth0 parent 1:3 handle 4: pfifo limit 1024

tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 divisor 1

tc filter add dev eth0 parent 1:0 prio 1 u32 match udp src 0x06B8 0xffff flowid 1:1
tc filter add dev eth0 parent 1:0 prio 1 u32 match udp dst 0x06B8 0xffff flowid 1:1

I tried looking at the stats using:

tc -stats filter show dev eth0

and this just lists all the filters.

Thanks,
..Ram

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/

#2 lore raw

Re: [LARTC] TC statistics

In reply to Serguei I. Ivantsov

Quoting "Nayak, Ramakrishna" <[email protected]>:

Quoted 22 lines

All,

What kind of statistics are available using tc?

I have the following rules and I want to see the statistics something like number of packets transmitted from each queue.

The rules:

tc qdisc add dev eth0 root handle 1: prio bands 3 priomap 0 1 2

tc qdisc add dev eth0 parent 1:1 handle 2: pfifo limit 1024 tc qdisc add dev eth0 parent 1:2 handle 3: pfifo limit 1024 tc qdisc add dev eth0 parent 1:3 handle 4: pfifo limit 1024

tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 divisor 1

tc filter add dev eth0 parent 1:0 prio 1 u32 match udp src 0x06B8 0xffff flowid 1:1
tc filter add dev eth0 parent 1:0 prio 1 u32 match udp dst 0x06B8 0xffff flowid 1:1

Quoted 6 lines

I tried looking at the stats using:

tc -stats filter show dev eth0

and this just lists all the filters.

you can view you bands by TC -S QDISC
BUT see description of PRIOMAP usage i have posted 2 days ago

Oh one more note: SRC and DST are define "Source IP" and "Destination IP" for source port you must use SPORT, for destination port - DPORT.

---
This message contains no viruses.
Guaranteed by Kaspersky Anti-Virus.
www.antivirus.lv

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/

#3 lore raw

RE: [LARTC] TC statistics

In reply to Serguei I. Ivantsov
Quoted 37 lines

Quoting "Nayak, Ramakrishna" <[email protected]>:

Quoted 5 lines

All,

What kind of statistics are available using tc?

I have the following rules and I want to see the statistics

something

Quoted 6 lines

like number of packets transmitted from each queue.

The rules:

tc qdisc add dev eth0 root handle 1: prio bands 3 priomap 0 1 2

Quoted 7 lines

tc qdisc add dev eth0 parent 1:1 handle 2: pfifo limit 1024 tc qdisc add dev eth0 parent 1:2 handle 3: pfifo limit 1024 tc qdisc add dev eth0 parent 1:3 handle 4: pfifo limit 1024

tc filter add dev eth0 parent 1:0 protocol ip prio 1 u32 divisor 1

tc filter add dev eth0 parent 1:0 prio 1 u32 match udp src

0x06B8 0xffff

Quoted 2 lines

flowid 1:1
tc filter add dev eth0 parent 1:0 prio 1 u32 match udp dst

0x06B8 0xffff

Quoted 8 lines

flowid 1:1

I tried looking at the stats using:

tc -stats filter show dev eth0

and this just lists all the filters.

Quoted 7 lines

you can view you bands by TC -S QDISC
BUT see description of PRIOMAP usage i have posted 2 days ago

Oh one more note: SRC and DST are define "Source IP" and "Destination IP"
for source port you must use SPORT, for destination port - DPORT.

What is the difference between sport/dport you mention above and
src/dst found in
file iproute2/tc/f_u32.c function parse_udp?

What is the usage for both?

Thanks,

..Ram

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://ds9a.nl/2.4Routing/

#4 lore raw
In reply to Serguei I. Ivantsov

Hello,

i have to write a script to visualize the output of tc -s class show dev eth0 with rrdtool.
Or does anybody know of such a script , which is available for download ?

I assume the bps in "rate 5728bps 34pps" is Byte per Second. Is that right ?
How can i set all the counters back to zero ?
I did not found anything in the manpage of tc.

regards
Joerg

Signature · 7 lines
Jörg Hartmann		Tel: +49 391 40 00 125
[email protected]


_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
#5 lore raw
In reply to Serguei I. Ivantsov
Quoted 6 lines · Joerg Hartmann

Hello,

i have to write a script to visualize the output of tc -s class show dev eth0 with rrdtool.
Or does anybody know of such a script , which is available for download ?

Quoted 7 lines

I assume the bps in "rate 5728bps 34pps" is Byte per Second. Is that right ?
How can i set all the counters back to zero ?
I did not found anything in the manpage of tc.

regards
Joerg

Hi Joerg,

i use this script. It is not yet complete and as I am not very good in shell programming, you can probably do better, but it works ;-)

regards,
Simon

---- snip -----
#!/bin/bash

TC=/root/bin/tc
CLASS=$2

usage ()
{
echo
echo "Usage: $0 option class"
echo

   echo "  Options:  -r   show rate"
#  echo "            -s   show avg packet size"

echo
exit
}

# print uptime and hostname
printuptime ()
{
   test -z "$(uptime|grep day)" && echo 0 days
   test -z "$(uptime|grep day)" || echo $(uptime | awk {'print $3'}) days
   hostname
}
# an error has happened... return 0 traffic
error ()
{
   echo 0
   echo 0
   printuptime
   exit
}

rate()
{
RATE=echo $STATS|cut -f2 -d' '
echo $RATE
echo 0
printuptime
exit
}

# read info about class
test -z $CLASS && usage
STATS=`$TC -s class ls dev ppp0|grep -A1 $CLASS|grep Sent`
# parse arguments
test $1 = "-r" && rate
#test $1 = "-s" && size
# else
usage

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#6 lore raw
In reply to Serguei I. Ivantsov

Hi Gang,

I'm still experiencing some bandwidth starvation with my script (below), so I decided to look at the statistics by using:

tc -s qdisc show dev eth0 (where eth0 is the interface I'm trying to rate-limit outbound packets)

I get, for example:

qdisc sfq 21: quantum 1514b perturb 10sec
Sent 133527926 bytes 413260 pkts (dropped 0, overlimits 0)

qdisc sfq 20: quantum 1514b perturb 10sec
Sent 42622473 bytes 184396 pkts (dropped 0, overlimits 0)

qdisc htb 1: r2q 10 default 21 direct_packets_stat 0 Sent 176150399 bytes 597656 pkts (dropped 0, overlimits 137379)

On first appearance, I would think this is telling me that the overall limiting is kicking in, and I'm not limiting specifically in the class 21 (which is where I want the limiting).

Here's my script:

tc qdisc del dev eth0 root
tc qdisc add dev eth0 root handle 1: htb default 21
tc class add dev eth0 parent 1: classid 1:1 htb rate 370kbit
tc class add dev eth0 parent 1:1 classid 1:20 htb prio 0 rate 100kbit tc class add dev eth0 parent 1:1 classid 1:21 htb prio 1 rate 200kbit ceil 370kbit tc qdisc add dev eth0 parent 1:20 handle 20: sfq perturb 10
tc qdisc add dev eth0 parent 1:21 handle 21: sfq perturb 10

# Set high priority for a certain destination IP address:
tc filter add dev eth0 parent 1:0 protocol ip prio 0 u32 \
match ip dst 147.135.2.0/24 flowid 1:20

# Set high priority for <64 byte packets:
tc filter add dev eth0 parent 1:0 protocol ip prio 0 u32 \
match ip protocol 6 0xff \
match u8 0x05 0x0f at 0 \
match u16 0x0000 0xffc0 at 2 \
match u8 0x10 0xff at 33 \
flowid 1:20

# Set high priority for ICMP packets:
tc filter add dev eth0 parent 1:0 protocol ip prio 0 u32 \
match ip protocol 1 0xff \
flowid 1:20

# Set high priority for UDP packets (hopefully all VOIP!):
tc filter add dev eth0 parent 1:0 protocol ip prio 0 u32 \
match ip protocol 17 0xff \
flowid 1:20

Am I reading this incorrectly?

Bob

_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc