How to get burst value from TBF disc

24 views
Skip to first unread message

Sławek Kapłoński

unread,
Mar 15, 2018, 11:32:38 AM3/15/18
to pyroute2-dev
Hi,

I have simple script to set and then read value of tbf qdisc of interface:

import pprint
import pyroute2


device = "test_tap_tbf"
ip = pyroute2.IPRoute()

idx = ip.link_lookup(ifname=device)[0]
ip.tc("replace", 'tbf', idx, 0, rate='1024kbit', latency='50ms', burst=1540)

qdiscs = ip.get_qdiscs(idx)
pprint.pprint(qdiscs)


As a result I have something like
[{'attrs': [('TCA_KIND', 'tbf'),
            ('TCA_OPTIONS', {'attrs': [('TCA_TBF_PARMS', {'rate___reserved': 1, 'rate_mpu': 0, 'buffer': 187984, 'rate_cell_align': 0, 'peak_overhead': 0, 'rate': 128000, 'rate_overhead': 0, 'peak_cell_align': 0, 'peak_cell_log': 0, 'rate_cell_log': 0, 'limit': 7940, 'mtu': 0, 'peak_mpu': 0, 'peak___reserved': 0, 'peak': 0})]}),
            ('TCA_STATS2', {'attrs': [('TCA_STATS_BASIC', {'packets': 0, 'bytes': 0}), ('TCA_STATS_QUEUE', {'qlen': 0, 'requeues': 0, 'overlimits': 0, 'drops': 0, 'backlog': 0})]}),
            ('TCA_STATS', {'pps': 0, 'qlen': 0, 'bytes': 0, 'drop': 0, 'packets': 0, 'overlimits': 0, 'bps': 0, 'backlog': 0})],
  'event': 'RTM_NEWQDISC',
  'family': 0,
  'handle': 2150825984,
  'header': {'error': None,
             'flags': 2,
             'length': 180,
             'pid': 19331,
             'sequence_number': 257,
             'type': 36},
  'index': 27636,
  'info': 2,
  'pad1': 0,
  'pad2': 0,
  'parent': 4294967295}]

As I know that rate value is what I set as rate but in bits, I have no idea how to get burst value from it and in what units it is. Can someone maybe help me how to find it there?

Peter Saveliev

unread,
Mar 17, 2018, 2:57:31 AM3/17/18
to Sławek Kapłoński, pyroute2-dev
I'm not sure that the kernel returns that info, but we'll see. Let me investigate a bit.

--
You received this message because you are subscribed to the Google Groups "pyroute2-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyroute2-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted
Message has been deleted

Peter Saveliev

unread,
Mar 20, 2018, 4:14:42 PM3/20/18
to Sławek Kapłoński, pyroute2-dev
Good to know! Thanks, I'll take a look!

2018-03-19 11:44 GMT+01:00 Sławek Kapłoński <sla...@kaplonski.pl>:
When I check it with "tc" CLI tool it gives me burst value properly so I am pretty sure that kernel returns this value somehow :)
To unsubscribe from this group and stop receiving emails from it, send an email to pyroute2-dev...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages