Skip to contentSkip to conversation

was tcng error; now found bug in tcc]

LARTC [email protected] 1 participant 2 messages Nov 27, 2003 – Nov 28, 2003

lore
Share & tools
lore
#0 lore raw

hi all,

after slicing and dicing, i found that i had cut and pasted bad syntax, so i have solved the problem posted in my first message.

that said, i have found an issue in 9h and 9i of tcng running on a bi-processor with redhat-8 up2date with 2.4.20 kernel.

here's a small tcng cfg:

#define DEVICE eth0
#define UPLINK 512

dev DEVICE {
    egress {
        htb () {
            class (rate UPLINK kbps) {
            }
        }
    }
}

[root]# cat tc.bug | tcc
tc qdisc add dev eth0 handle 1:0 root dsmark indices 1 default_index 0 tc qdisc add dev eth0 handle 2:0 parent 1:0 htb
tc class add dev eth0 parent 2:0 classid 2:1 htb rate 64000bps ------------------------------------------------------^^^^^^^^

notice that the UPLINK of 512 kbps (arguably 524288 bps) has been incorrectly calculated as 64000 bps

similarly, the following:

#define DEVICE eth0
#define UPLINK 64

dev DEVICE {
    egress {
        htb () {
            class (rate UPLINK kBps) {
            }
        }
    }
}

[root]# cat tc.bug | tcc
tc qdisc add dev eth0 handle 1:0 root dsmark indices 1 default_index 0 tc qdisc add dev eth0 handle 2:0 parent 1:0 htb
tc class add dev eth0 parent 2:0 classid 2:1 htb rate 64000bps ------------------------------------------------------^^^^^^^^

if i express the UPLINK in kilobytes/s, then the rate has been incorrectly multiplied by 1000 instead equaling 64 * 8 * 1024 = 524288

have i missed something, or indeed there is a problem??

many thanks

charles

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

#1 lore raw

Re: [LARTC] was tcng error; now found bug in tcc

hi werner,

thanks very much -- i've got it now!

btw, tcng is just great -- simply marvelous!

cheers

charles

Quoted 19 lines · Werner Almesberger
Quoted 1 line · [email protected] wrote:

have i missed something, or indeed there is a problem??

No, all this should be correct - in "tc", "bps" means Bytes per second. And in tcng, rates and packets use the multiplier 1000, while bit and byte sizes use the multiplier 1024. This just follows what is the most common use for the respective unit.

If you don't like the 1000 multiplier, you can just

#define bps b/1s
#define kbps kb/1s
#define Mbps Mb/1s
#define Gbps Gb/1s
#define Bps B/1s
#define kBps kB/1s
#define MBps MB/1s
#define GBps GB/1s

Quoted 1 line

- Werner

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