]> git.proxmox.com Git - mirror_iproute2.git/commit - include/utils.h
ip: Introduce get_rtnl_link_stats_rta() to get link statistics
authorSerhey Popovych <serhe.popovych@gmail.com>
Wed, 7 Feb 2018 06:30:52 +0000 (08:30 +0200)
committerDavid Ahern <dsahern@gmail.com>
Thu, 8 Feb 2018 00:15:28 +0000 (16:15 -0800)
commit9a7bd5442b2d57b94ec4d0f5b35ac444c5526703
tree5a0fb55b7d92c038038711cd2de72d93987b9ad0
parentfb7b8168279cc1a1bc6124d8765d3367b68996be
ip: Introduce get_rtnl_link_stats_rta() to get link statistics

Assume all statistics in ip(8) represented either by IFLA_STATS64 or
IFLA_STATS is 64 bit. It is clean that we can store __u32 counters of
@struct rtnl_link_stats in __u64 counters in @struct rtnl_link_stats64.

New get_rtnl_link_stats_rta() follows __print_link_stats() behaviour on
handling of stats attribute: copy no more than size of data structure
and no less than attribute length zeroing rest.

Drop print_link_stats32() as it's functionality can be handled by 64bit
variant. Move code from __print_link_stats() to print_link_stats64() and
finally rename print_link_stats64() to __print_link_stats().

More users of introduced function will come in future.

Signed-off-by: Serhey Popovych <serhe.popovych@gmail.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
include/utils.h
ip/ipaddress.c
lib/utils.c