A program calling rtnl_cls_alloc_cache() updates the TC action list, but stats are not updated. They are present in the netlink message created by kernel, but as cls_msg_parser() calls rtnl_act_parse() the netlink attribute of TC statistics is never parsed.
Here is an example from bmon:
(gdb) bt
#0 gact_msg_parser (tc=0x48dcb0, data=0x48dde0) at lib/route/act/gact.c:26
#1 0x00007ffff7e92544 in rtnl_act_parse (head=head@entry=0x48db70, tb=<optimized out>) at lib/route/act.c:447
#2 0x00007ffff7e92763 in flower_msg_parser (tc=<optimized out>, data=0x48db70) at lib/route/cls/flower.c:75
#3 0x00007ffff7ec66db in rtnl_tc_msg_parse (n=<optimized out>, tc=0x48da40) at lib/route/tc.c:175
#4 0x00007ffff7e936e6 in cls_msg_parser (ops=<optimized out>, who=<optimized out>, nlh=0x48d930, pp=0x7fffffffd530) at lib/route/cls.c:452
#5 0x00007ffff7f061a2 in nl_cache_parse (params=<optimized out>, nlh=<optimized out>, who=<optimized out>, ops=<optimized out>) at lib/cache.c:989
#6 nl_cache_parse (ops=0x7ffff7ef14e0 <rtnl_cls_ops.lto_priv>, who=0x48c718, nlh=0x48d930, params=0x7fffffffd530) at lib/cache.c:979
#7 0x00007ffff7f061ef in update_msg_parser (msg=<optimized out>, arg=<optimized out>) at lib/cache.c:665
#8 0x00007ffff7f0ae21 in nl_cb_call (msg=<optimized out>, type=<optimized out>, cb=<optimized out>) at ./include/netlink-private/netlink.h:139
#9 recvmsgs (cb=0x48d680, sk=0x423d90) at lib/nl.c:1000
#10 nl_recvmsgs_report (sk=0x423d90, cb=0x48d680) at lib/nl.c:1051
#11 0x00007ffff7f0b5dd in nl_recvmsgs (sk=sk@entry=0x423d90, cb=cb@entry=0x48d680) at lib/nl.c:1075
#12 0x00007ffff7f0b6c4 in __cache_pickup (sk=sk@entry=0x423d90, cache=cache@entry=0x48c6d0, param=param@entry=0x7fffffffd530) at lib/cache.c:698
#13 0x00007ffff7f0b7ba in __nl_cache_pickup (checkdup=<optimized out>, cache=<optimized out>, sk=<optimized out>) at lib/cache.c:745
#14 nl_cache_pickup (sk=sk@entry=0x423d90, cache=cache@entry=0x48c6d0) at lib/cache.c:778
#15 0x00007ffff7f0b8bd in nl_cache_refill (sk=sk@entry=0x423d90, cache=cache@entry=0x48c6d0) at lib/cache.c:1058
#16 0x00007ffff7e8dd48 in rtnl_cls_alloc_cache (sk=0x423d90, ifindex=14, parent=parent@entry=4294967282, result=result@entry=0x7fffffffd5e8) at lib/route/cls.c:333
#17 0x000000000040a01c in find_cls (rdata=0x7fffffffd5f0, parent=4294967282, ifindex=<optimized out>) at in_netlink.c:659
#18 handle_qdisc (obj=obj@entry=0x431650, arg=arg@entry=0x7fffffffd640) at in_netlink.c:700
#19 0x000000000040a4c5 in handle_tc (link=0x430c70, e=0x488b60) at in_netlink.c:749
#20 do_link (obj=0x430c70, arg=<optimized out>) at in_netlink.c:859
#21 0x00007ffff7f093d9 in nl_cache_foreach_filter (cache=0x422330, filter=0x0, cb=0x40a0c0 <do_link>, arg=0x0) at lib/cache.c:1316
#22 0x0000000000409341 in module_foreach_run_enabled (ss=ss@entry=0x419d80 <input_subsys>) at module.c:55
#23 0x00000000004060aa in input_read () at input.c:73
#24 0x000000000040414b in main (argc=1, argv=0x7fffffffda18) at bmon.c:349
Since TC classifiers have zero statistics, we should at least be able to traverse the action list to get counters from TC actions: at least the statistics from the first TC action in the list provide a good hit counter for TC classifiers.
A program calling
rtnl_cls_alloc_cache()
updates the TC action list, but stats are not updated. They are present in the netlink message created by kernel, but ascls_msg_parser()
callsrtnl_act_parse()
the netlink attribute of TC statistics is never parsed.Here is an example from bmon:
Since TC classifiers have zero statistics, we should at least be able to traverse the action list to get counters from TC actions: at least the statistics from the first TC action in the list provide a good hit counter for TC classifiers.