Wrong struct rtnl_htb_class and rtnl_ratespec?

Adrian Ban adrian.ban at mantech.ro
Thu Nov 24 14:56:30 EST 2011


Hi,

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;
};

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;
};

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;
};


struct tc_ratespec {
         unsigned char   cell_log;
         unsigned char   __reserved;
         unsigned short  overhead;
         short           cell_align;
         unsigned short  mpu;
         __u32           rate;
};

First thing is that prio is always 0 even I set it.

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:

With libnl:
class htb 1:1 root rate 1000Mbit ceil 1000Mbit burst 80000b cburst 80000b
  Sent 8659609 bytes 6098 pkt (dropped 0, overlimits 0 requeues 0)
  rate 1813Kbit 160pps backlog 0b 0p requeues 0
  lended: 0 borrowed: 0 giants: 0
  tokens: 9843 ctokens: 9843

class htb 1:5 parent 1:1 leaf 5: prio 0 rate 128000bit ceil 128000bit 
burst 106b cburst 106b
  Sent 8871584 bytes 6238 pkt (dropped 0, overlimits 0 requeues 0)
  rate 1874Kbit 166pps backlog 0b 22p requeues 0
  lended: 1524 borrowed: 0 giants: 0
  tokens: -1353336 ctokens: -1353336


With tc:
class htb 1:1 root rate 1000Mbit ceil 1000Mbit burst 1375b cburst 1375b
  Sent 482310 bytes 340 pkt (dropped 0, overlimits 0 requeues 0)
  rate 110112bit 10pps backlog 0b 0p requeues 0
  lended: 0 borrowed: 0 giants: 0
  tokens: -1047 ctokens: -1047

class htb 1:5 parent 1:1 leaf 5: prio 5 rate 128000bit ceil 128000bit 
burst 1600b cburst 1600b
  Sent 535968 bytes 379 pkt (dropped 0, overlimits 0 requeues 0)
  rate 113624bit 10pps backlog 0b 7p requeues 0
  lended: 211 borrowed: 0 giants: 0
  tokens: -9898272 ctokens: -9898272






More information about the libnl mailing list