Skip to contentSkip to conversation

Info from tc show

LARTC Orlie Brewer 1 participant 1 message Jul 25, 2003

lore
Share & tools
lore
#0 lore raw

Hello,

I've a question about getting information using "tc show" and the underlying rtnetlink sockets. Given the following (similar to the core device example in Almesberger's paper "Differentiated Services on Linux")

tc qdisc add dev eth0 handle 1:0 root dsmark indices 64 set_tc_index tc qdisc add dev eth0 parent 1:0 handle 2:0 htb

Then, the following

tc -d qdisc show dev eth0

gives

qdisc htb 2: r2q 10 default 0 direct_packets_stat 0 ver 3.6 qdisc dsmark 1: indices 0x0040 set_tc_index
So now my question, how can a process (without access to the command that created the qdiscs) get the information that the root dsmark qdisc 1:0 is the parent of the htb qdisc 2:0, or alternatively, that the htb qdisc 2:0 belongs to the root dsmark qdisc 1:0?

Looking at the code for tc, parent is only printed if t->tcm_parent is nonzero. If one looks at /usr/src/linux/net/sched/sch_api.c, in tc_fill_qdisc, t->tcm_parent is set to clid, which is the third parameter to the function. Looking at the call to tc_fill_qdisc in tc_dump_qdisc, the third parameter is the constant 0.

Looking at /usr/src/linux/net/sched/sch_dsmark.c, it looks like the the htb qdisc 2:0 is stored in the struct Qdisc *q field of the struct dsmark_qdisc_data, so that dsmark_dump could return q->handle, but that would require an new enum (TCA_DSMARK_QHANDLE or something) in the dsmark section of /usr/src/linux/include/linux/pkt_sched.h and of course a couple lines of code in dsmark_dump.

Is there any way of getting that info without hacking the kernel modules?

Thanks for any comments.

Orlie

    Orlie Brewer
    The Boeing Company         VOICE: (425) 865 - 3191,
    P.O. Box 3707, MS 7L-48    FAX:   (425) 865 - 2965
    Seattle, WA 98124-2207     EMAIL: [email protected]

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