• Vladimir Oltean's avatar
    net: ethtool: add helpers for aggregate statistics · 449c5459
    Vladimir Oltean authored
    When a pMAC exists but the driver is unable to atomically query the
    aggregate eMAC+pMAC statistics, the user should be given back at least
    the sum of eMAC and pMAC counters queried separately.
    
    This is a generic problem, so add helpers in ethtool to do this
    operation, if the driver doesn't have a better way to report aggregate
    stats. Do this in a way that does not require changes to these functions
    when new stats are added (basically treat the structures as an array of
    u64 values, except for the first element which is the stats source).
    
    In include/linux/ethtool.h, there is already a section where helper
    function prototypes should be placed. The trouble is, this section is
    too early, before the definitions of struct ethtool_eth_mac_stats et.al.
    Move that section at the end and append these new helpers to it.
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    449c5459
stats.c 18.5 KB