• Petr Machata's avatar
    net: rtnetlink: Add UAPI for obtaining L3 offload xstats · 0e7788fd
    Petr Machata authored
    Add a new IFLA_STATS_LINK_OFFLOAD_XSTATS child attribute,
    IFLA_OFFLOAD_XSTATS_L3_STATS, to carry statistics for traffic that takes
    place in a HW router.
    
    The offloaded HW stats are designed to allow per-netdevice enablement and
    disablement. Additionally, as a netdevice is configured, it may become or
    cease being suitable for binding of a HW counter. Both of these aspects
    need to be communicated to the userspace. To that end, add another child
    attribute, IFLA_OFFLOAD_XSTATS_HW_S_INFO:
    
        - attr nest IFLA_OFFLOAD_XSTATS_HW_S_INFO
    	- attr nest IFLA_OFFLOAD_XSTATS_L3_STATS
     	    - attr IFLA_OFFLOAD_XSTATS_HW_S_INFO_REQUEST
    	      - {0,1} as u8
     	    - attr IFLA_OFFLOAD_XSTATS_HW_S_INFO_USED
    	      - {0,1} as u8
    
    Thus this one attribute is a nest that can be used to carry information
    about various types of HW statistics, and indexing is very simply done by
    wrapping the information for a given statistics suite into the attribute
    that carries the suite is the RTM_GETSTATS query. At the same time, because
    _HW_S_INFO is nested directly below IFLA_STATS_LINK_OFFLOAD_XSTATS, it is
    possible through filtering to request only the metadata about individual
    statistics suites, without having to hit the HW to get the actual counters.
    Signed-off-by: default avatarPetr Machata <petrm@nvidia.com>
    Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    0e7788fd
rtnetlink.c 145 KB