[PATCH RFC 0/3] Broadcasting qdisc statistics via netlink

Toke Høiland-Jørgensen toke at toke.dk
Mon Jun 10 08:39:46 EDT 2013


These patches are my attempt to implement periodical broadcast of qdisc
statistics via netlink. The goal is to be able to monitor qdisc stats
without having to poll (as tc does).

What it does:

- On packet dequeue, broadcast a netlink multicast packet with the qdisc
  statistics. There's a sysctl parameter that sets the minimum interval
  between two consecutive broadcasts. The broadcast is done while the
  qdisc lock is still held (I think), so no new locking is done.

- Right now the only new statistics being gathered is that I added qlen
  statistics to pfifo_fast (since they were missing), but otherwise it's
  basically what tc gets on `tc -s qdisc`. Oh, and the rate estimation
  is missing, because it complained about locking.


I'm hoping some of you can comment on the usefulness of this approach,
and point out to me where I'm doing things wrong. It's working to the
point where there is some output, but not quite the way I've envisioned
(there's certainly not a netlink packet broadcast for each packet
dequeued).

Anyway, the patches follow (they're against Linux 3.9.4). There's a
client at https://github.com/tohojo/netlink-client which requires libnl
and cmake to build; run it as `./netlink-client -i <iface>` and it'll
print what it receives from the kernel for 60 seconds (set duration with
-l).

Thanks,
-Toke

Toke Høiland-Jørgensen (3):
  Broadcast qdisc statistics via netlink on packet dequeue.
  Add qdisc_stats_broadcast_interval sysctl parameter, and use it to
    limit     stats broadcast interval.
  Make pfifo_fast track qlen stats.

 include/net/netns/ipv4.h       |  4 ++
 include/net/sch_generic.h      |  4 ++
 include/uapi/linux/rtnetlink.h | 15 ++++---
 net/core/gen_stats.c           |  6 ++-
 net/ipv4/sysctl_net_ipv4.c     | 13 ++++++
 net/sched/Kconfig              |  8 ++++
 net/sched/sch_api.c            |  7 ++++
 net/sched/sch_generic.c        | 93 ++++++++++++++++++++++++++++++++++++++++++
 8 files changed, 143 insertions(+), 7 deletions(-)

-- 
1.8.3



More information about the Bloat-devel mailing list