Wrong struct rtnl_htb_class and rtnl_ratespec?
Adrian Ban
adrian.ban at mantech.ro
Fri Nov 25 16:00:56 EST 2011
I've saw that is used internally after a deeply check. The prio problem
is was fixed at least in the release 3.2.3. First time I've compiled my
code on 3.0 version (the Debian libnl3) and it hasn't the fix.
But the problem still remains: HTB rate/ceil doesn't work correctly.
For example I set a HTB class rate/ceil to 1500000 bytes this is the
output:
class htb 1:5 parent 1:1 leaf 5: prio 5 rate 12000Kbit ceil 12000Kbit
burst 1599b cburst 1599b
Sent 401941549 bytes 283591 pkt (dropped 0, overlimits 0 requeues 0)
rate 22271Kbit 1963pps backlog 0b 0p requeues 0
lended: 18610 borrowed: 0 giants: 0
tokens: -25601 ctokens: -25601
If I set the rate/ceil to 2000000 the output is:
class htb 1:5 parent 1:1 leaf 5: prio 5 rate 16000Kbit ceil 16000Kbit
burst 1600b cburst 1600b
Sent 166400947 bytes 116667 pkt (dropped 0, overlimits 0 requeues 0)
rate 15848Kbit 1388pps backlog 0b 5p requeues 0
lended: 8049 borrowed: 0 giants: 0
tokens: -259039 ctokens: -259039
Both setups works fine with TC. In first step the class has rate but no
limits. It's saturate the link to the maximum speed. In second example
the rate is 2000000bytes/s or 16Mbit/s without problem.
I don't figure where is the problem. I've check the sources but
somewhere in calculation of rate table I've lost the track :).
The difference between those two setups is that on the second you can
see that rate line has a 5p which varies between 5 an 15. First is fixed
to 0.
I think that some parameters are calculated wrong for HTB.
Best regards,
Adrian
On 11/25/2011 5:31 PM, Thomas Graf wrote:
> On Thu, Nov 24, 2011 at 09:56:30PM +0200, Adrian Ban wrote:
>> Can you confirm that this is the write order of struct rtnl_htb_class?
>>
>> struct rtnl_htb_class
>> {
>> uint32_t ch_prio;
>> struct rtnl_ratespec ch_rate;
>> struct rtnl_ratespec ch_ceil;
>> uint32_t ch_rbuffer;
>> uint32_t ch_cbuffer;
>> uint32_t ch_quantum;
>> uint32_t ch_mask;
>> uint32_t ch_level;
>> };
> This structure is only used by libnl internally. It's not
> exported in the API and not used to format any messages
> sent to the kernel.
>
>> And in include/linux/pkt_sched.h I found:
>>
>> struct tc_htb_opt {
>> struct tc_ratespec rate;
>> struct tc_ratespec ceil;
>> __u32 buffer;
>> __u32 cbuffer;
>> __u32 quantum;
>> __u32 level; /* out only */
>> __u32 prio;
>> };
> This is the structure used to format the netlink messages
> when talking to the HTB module.
>
>> Also the tc_ratespec and rtnl_ratespec are different:
>>
>> struct rtnl_ratespec
>> {
>> uint8_t rs_cell_log;
>> uint16_t rs_overhead;
>> int16_t rs_cell_align;
>> uint16_t rs_mpu;
>> uint32_t rs_rate;
>> };
> This is the internal representation of a rate specification.
> This structure is never used to format, it's constructed
> by copying each field individually in rtnl_copy_ratespec()
>
>> First thing is that prio is always 0 even I set it.
> How do you set the prio? Via rtnl_htb_set_prio()? If you
> happen to set it internally you have to set the SCH_HTB_HAS_PRIO
> flag to ensure the value is copied to the netlink message?
>
>> Second I've found a strange behavior on a specific class which I've
>> set to 128000 biti and the rate is around 4Mbit. Same values build
>> with tc worked fine:
> Seems that burst is not calculated correctly. I'll look into this.
>
> _______________________________________________
> libnl mailing list
> libnl at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/libnl
More information about the libnl
mailing list